text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String [] argumentos) {
ObjectInputStream objeto =null;
try {
borrarPantalla();
objeto = new ObjectInputStream(new FileInputStream("ficheros/personasModificadas.dat"));
try {
Persona var=(Persona)objeto.readObject();
... | 7 |
private static String encode(final String content, final String encoding) {
try {
return URLEncoder.encode(content, encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET);
} catch (UnsupportedEncodingException problem) {
throw new IllegalArgumentException(problem);
}... | 2 |
public static void updateCompte(Compte compte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from compte where id_compte=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, compte.getId_compte());
... | 3 |
public static String[] arrangeAnagram (String[] aos) {
// 1. arrange the input date in a HashMap
HashMap<String, List<String>> hm = new HashMap<>();
for ( String ss : aos) {
String key = getKey(ss);
if ( !hm.containsKey(key) ) {
hm.put(key, new LinkedList<String>());
}
List<String> bucket ... | 3 |
protected void plan() {
isFinished = false;
//cancel already finished subgoals first
//most of the time, we won't get any units back from this
Iterator<Goal> git = subGoalList.iterator();
while (git.hasNext()) {
Goal g = git.next();
if (g.isFinish... | 9 |
protected int getMaxAge()
{
return MAX_AGE;
} | 0 |
private static TPoint[] parsePoints(String string) {
List<TPoint> points = new ArrayList<TPoint>();
StringTokenizer tok = new StringTokenizer(string);
try {
while(tok.hasMoreTokens()) {
int x = Integer.parseInt(tok.nextToken());
int y = Integer.parseInt(tok.nextToken());
points.add(new TPoint(... | 2 |
public int hasVariable(Variable v){
// If this predicate has no variables we can directly return -1.
if(varNum == 0){
return -1;
}
boolean found = false;
int i = 0;
while(i < varList.size() && !found){
boolean this_isDef = (varList.get(i) instanceof DefaultVariable);
boolean v_isDef = (v ... | 6 |
public Knight(boolean isWhite, ImageIcon imgIcon) {
super(isWhite, imgIcon);
this.setIcon();
} | 0 |
public void generateCode(String fileLocation){
//Make a list of Strings and populate it with the generated code
//from the generator.
Vector<String> output = CodeGenerator.generateCodeForVectorOfClasses(components);
//for each string in the list (which is a file)
for (String file:output){
//find out the na... | 4 |
private boolean doesWordContainLetter(String selection) {
int loc = -1;
int letterCount = -1;
// Check if the random word contains the selection
if (randomWord.contains(selection)) {
// If word was passed in check if it is right
if (randomWord.equals(selection)) {
isWinner = true;
displayWord... | 4 |
private void buildRuleList(String[] readedHolder) {
for (int y = 0; y < valueArray.length; y++) {
if (readedHolder[y].contains("*")) {
ruleList[y] = new Rule(1);
} else if (readedHolder[y].contains("\"R")) {
if (readedHolder[y].contains(",.")) {
... | 8 |
public void run() {
while (true) {
if (year!=w.year) {
year=w.year;
}
synchronized (this) {
repaint();
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
} | 3 |
public void stats(){
int[] cycleLengths = new int[bucket.size()];
double[] activities = new double[bucket.size()];
double cycleLengthMean, activityMean;
int cycleLengthMedian, cycleLengthUQ, cycleLengthLQ;
double activityMedian, activityUQ, activityLQ, activityVar, activityStdDev, cycleLen... | 2 |
public void delayRebirth() {
final Element element = this;
new Thread(new Runnable() {
public void run() {
try {
if (!active) {
Thread.sleep(rebirth_delay);
List<Integer> positions = Server.getPlayersPositio... | 7 |
@SuppressWarnings("unchecked")
private void load() {
try {
Project lastProject = null;
Date lastEntryDate = new Date(0);
Object o = null;
if (new File(SAVE_FILE).exists()) {
ObjectInputStream ois = new ObjectInputStream(
new FileInputStream(SAVE_FILE));
o = ois.readObject();
ois.close... | 8 |
public void testToStandardHours() {
Period test = new Period(0, 0, 0, 0, 5, 6, 7, 8);
assertEquals(5, test.toStandardHours().getHours());
test = new Period(0, 0, 0, 1, 5, 0, 0, 0);
assertEquals(29, test.toStandardHours().getHours());
test = new Period(0, 0, 0, 0... | 1 |
public Customer getCustomerForPallet(Pallet pallet) {
String sql =
"Select name, address "+
"from Orders,Customers "+
"where Orders.customerName = name and Orders.id = ? ";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.setLong(1, pallet.orderId);
} catch (SQLExceptio... | 5 |
public void fireAddnewDestroyerPressed() {
destroyerType = null;
String id = txtId.getText();
if (id.isEmpty()) {
JOptionPane.showMessageDialog(null, "You must fill a name first!");
return;
}
if (ironDomeRadioButton.isSelected()) {
destroyerType = ironDomeRadioButton.getText();
} else if (shipRadio... | 5 |
/* */ @EventHandler
/* */ public void onInventoryClick(InventoryClickEvent event)
/* */ {
/* 342 */ if (!(event.getWhoClicked() instanceof Player))
/* */ {
/* 344 */ return;
/* */ }
/* */
/* 348 */ Player p = (Player)event.getWhoClicked();
/* */
/* 350 */ if... | 2 |
public void updateButtons(LinkedList<ClickableObject> selection) {
for(ClickableObject selectable : selection) {
for(Ability ability : selectable.getAbilities()) {
addHability(ability);
}
}
} | 2 |
public void putAll( Map<? extends Double, ? extends Float> map ) {
Iterator<? extends Entry<? extends Double,? extends Float>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends Float> e = it.next();
this.put( e.get... | 8 |
public void run() {
// The following line nullifies timestamp-diff-cache.
if (!useTimestampDiffCache){
apicaCommunicator.checkResultTimeStamps.clear();
}
apicaCommunicator.populate(metrics);
DumpToStdOut(metrics);
write... | 1 |
public void setBlockSheet(int[][] blockSheet) {
this.blockSheet = blockSheet;
} | 0 |
private boolean[] attsTestedBelow() {
boolean[] attsBelow = new boolean[m_numAttributes];
boolean[] attsBelowLeft = null;
boolean[] attsBelowRight = null;
if (m_right != null) {
attsBelowRight = m_right.attsTestedBelow();
}
if (m_left != null) {
attsBelowLeft = m_left.attsTestedBe... | 8 |
private boolean confirm() {
if (!checkAndSetUid(uidField.getText(), pageTextBox, dialog))
return false;
pageTextBox.setBorderType((String) borderComboBox.getSelectedItem());
pageTextBox.putClientProperty("border", pageTextBox.getBorderType());
pageTextBox.setBackground(bgComboBox.getSelectedColor());
pageT... | 7 |
private void indicateSelection(JPanel panel) {
if (panel == this.pnlDashboard) {
this.mntmDashboard.setEnabled(false);
}
else {
this.mntmDashboard.setEnabled(true);
}
if (panel == this.pnlProducts) {
this.mntmProducts.setEnabled(false);
}
else {
this.mntmProducts.setEnabled(true);
}
if (pa... | 4 |
public void pushSolution(String failedPath, Host[] updatedHosts, Host... failedHosts) {
ArgumentCheck.checkNotNull(failedPath, "Cannot broadcast a null failed path.");
ArgumentCheck.checkNotNull(updatedHosts, "Cannot broadcast a null list of updated hosts.");
ArgumentCheck.checkNotNull(failedHos... | 8 |
public void compare(HashSet<Area> aAreas)
{
for (Area area : aAreas)
{
if (area == this) continue;
if (contains(area))
{
for (int tile : area.getTiles())
mTiles.remove(tile);
mBombs -= area.mBombs;
}
}
} | 4 |
public boolean crear(Object[] estructura) throws SecurityException{
String dir[]= (String[])estructura[0];
String dublin[]= (String[])estructura[1];
//try{
// crear un log
GregorianCalendar hoy = new Gre... | 8 |
public void testPropertyAddToCopyYear() {
LocalDate test = new LocalDate(1972, 6, 9);
LocalDate copy = test.year().addToCopy(9);
check(test, 1972, 6, 9);
check(copy, 1981, 6, 9);
copy = test.year().addToCopy(0);
check(copy, 1972, 6, 9);
copy = te... | 2 |
private static int getMeasure(final String stem)
{
List<Letter> letters = PorterStemmer.getLetters(stem);
int m = 0;
int start = 0;
int length = letters.size();
if (length == 0)
{
return 0;
}
// if the last element is a vowel, skip it
... | 5 |
public InPackage( String targetPackage )
{
this.targetPackage = targetPackage;
} | 0 |
private void findMaxMinCB(boolean max) {
double maxMin = (max)
? Double.NEGATIVE_INFINITY
: Double.POSITIVE_INFINITY;
Instances cBCurve = m_costBenefit.getPlotInstances();
int maxMinIndex = 0;
for (int i = 0; i < cBCurve.numInstances(); i++) {
Instance cur... | 7 |
public Integer fetchInteger() throws InputMismatchException, NumberFormatException {
if(peek().isEmpty())
throw new InputMismatchException("There are no integer arguments to fetch from.");
else {
Integer i = Integer.valueOf(pop());
return i;
}
} | 1 |
public boolean ModificarProducto(Producto p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} | 1 |
void setVisibilityFlags(BitSet bs) {
/*
* set all fixed objects visible; others based on model being displayed note
* that this is NOT done with atoms and bonds, because they have mads. When
* you say "frame 0" it is just turning on all the mads.
*/
for (int i = 0; i < meshCount; i++) {
... | 8 |
@Test
public void testSubgroupsOrder(){
Collection<? extends Symmetry<Point4D>> subgroups;
Collection<? extends Symmetry<Point4D>> rotationsymsub;
Reflection4D extEl;
int subgroupCounter;
for (Symmetry4DReflection g : Symmetry4DReflection.getSymmetries()) {
subgroupCounter = 0;
subgrou... | 8 |
private void teleportToMine() {
if (Util.inAuburyShop()) {
NPC aubury = NPCs.getNearest(Util.auburyId);
if (aubury.interact("teleport")) {
int time = 0;
while (!Util.inEssenceMine() && time <= 4000) {
time += 50;
Time.sleep(50);
}
}
}
} | 4 |
public static String display(char[][] array){
int k = 4;
String format = "%-3s";
String limit = " +"+new String(new char[array.length]).replace("\0","---+");
String deca = new String(new char[k]).replace("\0"," ");
String res = deca;
char row = 'A';
int line = 1;
//loop to display row letter
for(i... | 3 |
public void setQueue2(FloatQueue t) throws MismatchException {
if (t == null)
throw new NullPointerException("the arg cannot be null");
if (q1 != null) {
if (t.getLength() != q1.getLength())
throw new MismatchException("queue 1 and 2 have different lengths!");
if (t.getPointer() != q1.getPointer())
... | 9 |
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
// ctrl key
if (e.getModifiersEx() == 128) {
switch (e.getKeyCode()) {
// s key
case 83 :
file.promptSave();
break;
// o key
case 79 :
if (file.promptOpen()) {
undoManager.discardAllEdits();
}
break;
// ... | 7 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Spel spel = new Spel();
List<logic.Onderwerp> onderwerpen = spel.getOnderwerpen();
spel.setOnderwerp(onderwerpen.get(1));
List<logic.Onderdeel> ondrln = spel.getOnderdele... | 2 |
public BitSet diversify(List<Subset> neighborhood){
if(neighborhood == null)
return m_Sbest.subset;
BitSet result = new BitSet(m_numAttribs);
double [] counts = new double[m_numAttribs];
int numNeighborhood = neighborhood.size ();
for (int i = 0; i < m_numAttribs; i++) {
if(i == m_... | 7 |
protected void onMode(String channel, String sourceNick, String sourceLogin, String sourceHostname, String mode) {} | 0 |
public double getTFIDF(String termName, String document){
Term searchTerm = null;
for(Term term: tree){
if(term.getName().compareTo(termName.toLowerCase().trim()) == 0){
searchTerm = term;
}
}
if(searchTerm != null) {
termFrequency = ... | 3 |
public boolean stageOne() {
int smallest = 0, index = -1;
ArrayList<Node> tempNodeList = new ArrayList<Node>(4);
ArrayList<Integer> distance = new ArrayList<Integer>(4);
// Initialise 4 slots in distance ArrayList to -1
for (int i=0; i<4; i++) {
distance.add(-1);
tempNodeList.add(new Node(-1, -1));
}
... | 9 |
public void keyReleased(KeyEvent ke)
{
try
{
if (ke.getKeyCode() == 38)
{
if ((ke.getSource() == this.jtfCommand_Broadcast) || (ke.getSource() == this.jtfCommand_Private) || (ke.getSource() == this.jtfTerminalCommand))
{
moveCommandUp();
}
}
else if (... | 9 |
protected void encodePacket(OutputStream out, String sharedSecret, RadiusPacket request)
throws IOException {
// check shared secret
if (sharedSecret == null || sharedSecret.length() == 0)
throw new RuntimeException("no shared secret has been set");
// check request authenticator
if (request != null && ... | 7 |
public static void main(String args[]) {
NewThread3 ob1 = new NewThread3("One");
NewThread3 ob2 = new NewThread3("Two");
try {
Thread.sleep(1000);
ob1.t.suspend();
System.out.println("Suspending thread One");
Thread.sleep(1000);
ob1.t.resume();
System.out.println("Resuming thread One");
ob2.t.s... | 2 |
public void setSkillName(String skillName) {
this.skillName = skillName;
} | 0 |
public Serializable getObject() {
return theMainObject;
} | 0 |
private void postProduct() throws IOException {
if (!getTextArea().getText().isEmpty() && getTextField_name().getText().length() > 0) {
JSONObject postData = ApiUtil.fetchObject("products", getTextField().getText());
JSONObject result = postData.getJSONObject("result");
String name = result.get("name").toStr... | 4 |
private static int getTrackerId(Statement statement, String trackerName) throws SQLException {
int id = -1;
ResultSet resultSet = statement.executeQuery("select id from " + Settings.DB_TABLE_TRACKER + " where name like '"
+ trackerName + "' limit 1"); // SQL injection ?
if (resultSet.next()) {
... | 2 |
private void check() {
synchronized (ui) {
if (tgt && !wrapped.hasfs())
wrapped.setfs();
if (!tgt && wrapped.hasfs())
wrapped.setwnd();
}
} | 4 |
@Override
public String printStorage() {
String print = new String();
for (int i = 1; i <= aisleCount; i++) {
System.out.println(i);
Aisle aisle = (Aisle) manager.get("A" + i);
if (aisle == null) {
i++;
aisle = (Aisle) mana... | 6 |
public void init(File ff) {
try {
JarFile jf = new JarFile(ff);
System.out.println("------------------------------------------------------------");
String name = jf.getManifest().getMainAttributes().getValue("plugin-name");
String verStr = jf.getManifest().getMain... | 8 |
public static synchronized BufferedImage layoutAndRender(OdeAccess access) {
// Init sizes for layout generations
initSizes(access);
lindex++;
Graph conn = GraphIO.readGraph("graph-" + lindex + ".txt");
Visode[] vert = GraphIO.readVisodes("vishy-" + lindex + ".txt");
OdeAccess copy = null;
if (c... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... | 8 |
public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
}
return this.reference;
} | 1 |
private void btnCrearOfertaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCrearOfertaActionPerformed
if(tbxMonto.getText().trim().length() != 0 && tbxTipoCambio.getText().trim().length() != 0
&& cmbTipoOferta.getSelectedItem() != null)
{
try
{
... | 7 |
@Test
public void testRemoveClient() {
BlockingQueue<Client> currentObjectsList = null;
Client client1 = new Client("Diego", "111", "diego.sousa@dce.ufpb.br",
18, 11, 1988);
Client client3 = new Client("Kawe", "333", "kawe.ramon@dce.ufpb.br",
18, 11, 1988);
facade.addClient(client1);
facade.addCli... | 3 |
public void listenerButtonVideau()
{
if (!session.getParametreSession().isUtiliseVideau())
{
vuePartie.getPaneldroitencours().getVideau().setEnabled(false);
}
else
{
vuePartie.getPaneldroitencours().getVideau().addMouseListener(new MouseListener(){
@Override
public void mouseClicked(M... | 7 |
private boolean mtChecker(LinkedList<String>left,LinkedList<String>middle, LinkedList<String>consequent)
{
/*
* assume ~~~c
* assume ~~(b=>c)
* mt 1 2 ~~~b
*
* */
/*
* Potential Problems:
* - c
* - ~(b=>c)
* - ~b
*
* assert size at bottom of method might break things
... | 7 |
public String string2Json(String s) {
StringBuffer sb = new StringBuffer();
for (int i=0; i<s.length(); i++) {
char c = s.charAt(i);
switch (c){
case '\"':
sb.append("\\\"");
break;
case '\\': ... | 9 |
public void paint(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHints(rh);
g2d.drawImage(backgroundBuff, null, 0, 0);
if (backgroundBuff == null)
createBackground();
if (initDone && !participants.isEmpty()) {
... | 7 |
private void setfnames( String filename )
{
if( used() ) use(); // close previous files
String f = filename;
int l = f.length();
ext = (( l>4 && f.charAt(l-4) == '.' ) ? f.substring(l-3) : "" );
if( ext.toLowerCase().equals("dbf") ) { dbfname = f; f = f.substring(0,l-4); }
else { ext = "DBF" ; db... | 9 |
@Override
public void keyTyped(KeyEvent e) {
if (e.getKeyChar() == 'w') {
selectedItem = (selectedItem + 1) % items;
}
if (e.getKeyChar() == 's') {
if (selectedItem > 0) {
selectedItem--;
} else {
selectedItem = items - 1;
}
}
if (e.getKeyChar() == ' ') {
SoundManager.stop("chiptune"... | 9 |
@Override
public void stop(int objectId) {
AudioChannel channel = channels.get(objectId);
if (channel != null) {
alSourceStop(channel.source);
}
} | 1 |
public boolean isCompleted() {
return PeerState.COMPLETED.equals(this.state);
} | 0 |
public static boolean save() {
if (KeyList.values().size() == 0) { //If queue is empty OR economy is disabled.
KeysFile.delete();
return true;
}
ColorKeys.Log(Level.INFO, "Saving keys...");
try {
if (!KeysFile.exists()) {
if (!KeysFile.createNewFile()) {
ColorKeys.Log(Level.SEVERE, "Error c... | 6 |
public Direction hitObj(GameObj other) {
if (this.willIntersect(other)) {
double dx = other.pos_x + other.width /2 - (pos_x + width /2);
double dy = other.pos_y + other.height/2 - (pos_y + height/2);
double theta = Math.atan2(dy, dx);
double diagTheta = Math.atan2(height, width);
if ( -diagTheta <= ... | 7 |
public boolean onCommand(CommandSender s, Command command, String label, String[] args) {
if (args.length == 0 || getCommands(args[0]) == null) {
s.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.BOLD + "------------------[" + ChatColor.AQUA + ChatColor.BOLD + " Hubber " + ChatC... | 4 |
public Transition parseTransition(Id leftId, Id rightId, String transitionExpr) {
Transition transition = new Transition(leftId, rightId);
String[] leftAndRight;
if(transitionExpr.contains("-.-")) {
transition.usingLineStyle(Styles.LineStyle.Dashed);
leftAndRight = trans... | 5 |
protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
{
init();
this.options = options;
// an iterator for the command line tokens
Iterator iter = Arrays.asList(arguments).iterator();
// process each command line token
while (iter.... | 9 |
public Command getCommand(String inputLine)
{
//String inputLine = ""; // will hold the full input line
String word1;
String word2;
StringTokenizer tokenizer = new StringTokenizer(inputLine);
if(tokenizer.hasMoreTokens())
word1 = tokenizer.nextToken(); //... | 3 |
public ArrayList<GeoEvent> eventDataGenerator(JsonObject jsonObject){
ArrayList<GeoEvent> events = new ArrayList<GeoEvent>();
try {
JsonObject jobject = (JsonObject) jsonObject.getAsJsonObject("events");
JsonArray eventOb = jobject.getAsJsonArray("event");
for(JsonElement s : eventOb){
JsonObject even... | 7 |
public void run()
{
try{
System.out.println("Connecting on port: " +port);
InetAddress server = InetAddress.getByName(ip);
sConn = new Socket (server, port);
conInf=("Connected to: "+sConn.getInetAddress().getHostName()
+" on po... | 7 |
public static String getRelativePath(PackageDoc packDoc, PathType eparamssource)
{
String pkgPath = packDoc.name().replace('.', '/') + "/";
switch(eparamssource)
{
case eInterfaceHeader: return pkgPath + "interfaces.h";
case eProxyHeader: return pkgPath + "proxys.h";
case eProxySource: return pkgPath +... | 9 |
@RequestMapping(value = {"/search"})
public String findDepartments(@RequestParam(value = "name", required = false) String name, @RequestParam(value = "page", required = false) Integer page, Model model) {
if (name == null) {
name = "";
}
if (page == null) {
page = 0;
... | 3 |
public BESong getById(int id) throws SQLException {
for (BESong aSong : getAll()) {
if (aSong.getId() == id) {
return aSong;
}
}
return null;
} | 2 |
protected void effect() {
if (radius > 1) {
for (int x = -radius; x <= radius; ++x) {
for (int y = -radius; y <= radius; ++x) {
for (int z = -radius; z <= radius; ++z) {
Location loc = world.getBlockAt(X + x, Y + y, Z + z).getLocation();
world.playEffect(loc, effect, direction);
}
}
... | 4 |
static void handleUpdate(UpdateSet update)
{
ArrayList vmUpdates = new ArrayList();
ArrayList hostUpdates = new ArrayList();
PropertyFilterUpdate[] pfus = update.getFilterSet();
for(int i=0; i<pfus.length; i++)
{
ObjectUpdate[] ous = pfus[i].getObjectSet();
for(int ... | 8 |
public Animation getAnim()
{
Animation anim = null;
switch(state)
{
case IDLE:
anim = idleAnimation;
break;
case WALK:
anim = walkAnimation;
break;
case JUMP:
anim = jumpAnimation;
break;
case FALL:
anim = fallAnimation;
break;
case LAND:
anim = landAnimation;
break;
}
... | 7 |
public void removeTask(Task task)
{
if (DEBUG) log("Find the taskWidget that contains the desired task");
TaskWidget target = null;
for (TaskWidget tw : taskWidgets)
{
if (tw.getTask() == task)
{
target = tw;
}
}
if (target == null)
{
if (DEBUG) log("Failed ... | 6 |
public Map<String, Object> getAllTypes() {
Map<String, Object> types = new HashMap<String, Object>();
// Cr�ation de la requ�te
java.sql.Statement query;
try {
// create connection
connection = java.sql.DriverManager.getConnection("jdbc:mysql://"
+ dB_HOST + ":" + dB_PORT + "/" + dB_NAME, dB_... | 2 |
private static int[][] calculateDistances2(double[][] points,int N) {
int[][] distanceMatrix= new int[N][N];
for(int i=0; i<N;i++){
for(int j=0;j<N;j++){
if(j==i){
distanceMatrix[i][j]=0;
} else if(i<j){
distanceMatrix[i][j]=distance(points[0][i],points[0][j],points[1][i],points[1][j]);
} e... | 4 |
public Group(GoGame game1)
{
game = game1;
pieces = new HashSet<Piece>();
liberties = new HashSet<Square>();
} | 0 |
public boolean hasPathTo(Node to)
{
if (edgeTo.containsKey(to))
{
return true;
} else
{
return false;
}
} | 1 |
public static String changeExtension(String a){
int cnt = 0;
String tempo = "";
while(cnt < (a.length() - 5)){
tempo = tempo + a.charAt(cnt);
cnt++;
}
tempo = tempo + ".jpg";
return tempo;
} | 1 |
static void calculate_sprites_areas()
{
//UINT8 sx,sy;
int[] sx=new int[1];
int[] sy=new int[1];
int i,minx,miny,maxx,maxy;
for (i = 0x00; i < 0x20; i++)
{
if ((i >= 0x10) && (i <= 0x17)) continue; /* no sprites here */
if (get_sprite_xy(i, sx, sy)!=0)
{
minx = ... | 8 |
boolean whitelisted(String page, String user, String summary, String project) {
if (config.whitelistModel.contains(user + "#" + project)
|| config.tempwhitelistModel.contains(user + "#" + project))
return (true);
else {
int size = config.regexpwhiteModel.getSize(), i;
for (i = 0; i < ... | 9 |
public static boolean isValid(final List<S2Loop> loops) {
// If a loop contains an edge AB, then no other loop may contain AB or BA.
// We only need this test if there are at least two loops, assuming that
// each loop has already been validated.
if (loops.size() > 1) {
Map<UndirectedEdge, LoopVer... | 8 |
public boolean isBlack() {
if (myColor.equals(BLACK))
return true;
return false;
} | 1 |
public CtMethod[] getMethods() {
try {
return getSuperclass().getMethods();
}
catch (NotFoundException e) {
return super.getMethods();
}
} | 1 |
private void getTourCollection(List<Direction> directions, AbstractDao dao, Criteria criteria) throws DaoException {
for (Direction dir : directions) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_DIRECTION, dir.getIdDirection());
crit.addParam(DAO_TOUR_STATUS, criter... | 1 |
public int getWildCardRank()
{
return wildCardRank;
} | 0 |
private void botonAniadirCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAniadirCompraActionPerformed
// Esto sólo añade a la lista, NO al map, para que se añada al map se debe guardar
DefaultTableModel modeloCompra = ((DefaultTableModel) jTableCompras.getModel());
... | 5 |
private void removeHighlight(int start, int end) {
Highlighter.Highlight remove = null;
for (Highlighter.Highlight h : editor.getHighlighter().getHighlights()) {
if (h.getStartOffset() == start && h.getEndOffset() == end) {
remove = h;
break;
}
... | 4 |
int[] loadIntArray() throws IOException {
int n = loadInt();
if (n == 0)
return NOINTS;
// read all data at once
int m = n << 2;
if (buf.length < m)
buf = new byte[m];
is.readFully(buf, 0, m);
int[] array = new int[n];
for (int i = 0, j = 0; i < n; ++i, j += 4)
array[i] = luacLittleEndian ? (b... | 4 |
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.