text stringlengths 14 410k | label int32 0 9 |
|---|---|
public double correlationZeroTime(double[] sign1, double[] sign2){
double sum = 0.0;
if(sign1.length == sign2.length)
for(int i=0; i < sign1.length; i++)
sum += (sign1[i] * sign2[i]);
else System.out.println("The length of sign1 and sign2 is not the same.");
return (sum<0.00001)?0:sum;
} | 3 |
@Override
public void actualiza(long tiempoTranscurrido) {
if(pausa) { //si esta pausado, no se actualiza
return;
}
checaColision();
//actualiza las animaciones
bola.getAnimacion().actualiza(tiempoTranscurrido);
barra.getAnimacion().actua... | 4 |
public void printRoute(int[] route){
for(int i = 0;i<route.length;i++){
System.out.print(route[i]+" ");
}
} | 1 |
public String find(String word) {
String likes = "Likes";
String dislikes = "Dislikes";
if (word.toUpperCase() != word) {
return dislikes;
}
char previousC = 0;
for (char c : word.toCharArray()) {
if (c == previousC) {
return dislikes;
}
previousC = c;
}
for (int i = 0; i < word.lengt... | 9 |
private org.apache.commons.httpclient.HttpClient getHttpClient(){
org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient();
if (proxyHost != null && !proxyHost.equals("")) {
client.getHostConfiguration().setProxy(proxyHost, proxyPort);
client.getParams().setAuth... | 4 |
@Override
public void load(Map<String, Object> map) throws DataLoadFailedException {
super.load(map);
Object obj = map.get("groups");
if (obj instanceof List) {
List list = (List) obj;
for (Object o : list) {
if (o instanceof String) {
... | 4 |
private void arrivalInit(double[] aarr, double[] barr,
double[] anum, double[] bnum, int start_hour, double weights[][]) {
int idx, moveto = CYCLIC_DAY_START;
double[] mean = new double[] {0,0};
for(int i=0; i<weights.length; i++) {
for(int j=0; j<weights[i].length; j++) {
weig... | 6 |
public boolean smaller(double tmp) {
boolean flag = true;
for (int i = 0; i < p.length - 1; i++) {
if (Math.abs(p[i]) > epsilon) {
flag = false;
}
}
if (flag == true && p[p.length - 1] < tmp)
return true;
else
return false;
} | 4 |
private int getFirstArgEndIndex() {
int l = arg.length();
// An empty string can't have any arguments
if(l == 0) {
return -1;
}
int i;
for(i = 0; i < l; i++) {
char c = arg.charAt(i);
if(c == '\"') {
i = getSectionEndIndex(i, '\"');
} else if (c == '[') {
i = getSectionEndIndex(i, ']');
... | 6 |
*/
public void visit_ldc(final Instruction inst) {
final Object value = inst.operand();
Type type;
if (value == null) {
type = Type.NULL;
} else if (value instanceof Integer) {
type = Type.INTEGER;
} else if (value instanceof Long) {
type = Type.LONG;
} else if (value instanceof Float) {
type ... | 7 |
public int numOf2s(int n) {
// Ending condition:
if (n == 0) {
return 0;
}
// get the top digit
int top = new Integer(n).toString().toCharArray()[0] - '0';
int numOfDigits = new Integer(n).toString().length();// String.getLength()???
int next = n - top * (int) Math.pow(10, numOfDigits - 1);
int nines... | 3 |
final private boolean jj_3R_37() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_64()) {
jj_scanpos = xsp;
if (jj_3R_65()) {
jj_scanpos = xsp;
if (jj_3R_66()) {
jj_scanpos = xsp;
if (jj_3R_67()) {
jj_scanpos = xsp;
if (jj_3R_68()) {
jj_scanpos = xsp;
if (jj_3R_69()) {
jj... | 8 |
public static void replyToPlayer( String sender, String message ) {
BSPlayer p = PlayerManager.getPlayer( sender );
String reply = p.getReplyPlayer();
if ( p.isMuted() && ChatConfig.mutePrivateMessages ) {
p.sendMessage( Messages.MUTED );
return;
}
if ( re... | 3 |
private void shootFirework(Location loc) {
Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
Random r = new Random();
int rt = r.nextInt(5) + 1;
FireworkEffect.Type type = FireworkEffect.Type.BALL;
if... | 5 |
HashSet getAllspTempOutliers() throws SQLException {
ArrayList<ArrayList<String>> results= new ArrayList<ArrayList<String>>();
RegionIdData rid=new RegionIdData();
ArrayList<String> smallList=rid.getCentralCoordinate(region);
results.add(smallList);
String months="JAN FEB MAR APR M... | 8 |
static public OutputChannels fromInt(int code)
{
switch (code)
{
case LEFT_CHANNEL:
return LEFT;
case RIGHT_CHANNEL:
return RIGHT;
case BOTH_CHANNELS:
return BOTH;
case DOWNMIX_CHANNELS:
return DOWNMIX;
default:
throw new IllegalArgumentException("Invalid channel code: "+code);
}
} | 4 |
public static double [][] loadBandwidth()
{
double[][] ret = new double[4][2001];
File file = new File("bandwidth.txt");
FileReader fr;
StringTokenizer tokenizer;
int cnt = 0;
try {
fr = new FileReader(file);
BufferedReader inFile = new BufferedReader(fr);
String line = inFile.readLine();
int d... | 8 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean first = true;
while (input.hasNext()) {
// extra line between input cases
if (!first) System.out.println();
first = false;
int numPpl = input.nextInt();
// store the people in order
HashMap<String, Integ... | 7 |
public static void main(String args[]) throws UnsupportedLookAndFeelException {
/* 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.... | 6 |
public final Boolean validate(final Integer newYear, final Integer newMonth, final Integer newDay) {
//some rough testing
if (newDay.equals(null)
|| newDay <= 0
|| newDay > MAX_DAYS_IN_MONTH
|| newMonth.equals(null)
|| newMonth <= 0
|| newMonth > MAX_MONTH_IN_YEAR
|| newYear.equals(nul... | 9 |
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | 6 |
public static void load(final List<ScriptInfo> scripts, final File file) throws ClassNotFoundException, IOException, IllegalAccessException, InstantiationException {
final JarFile jar = new JarFile(file);
final Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
... | 5 |
private void writeBitmap() throws Exception {
int size;
int value;
int j;
int i;
int rowCount;
int rowIndex;
int lastRowIndex;
int pad;
int padCount;
byte rgb[] = new byte[3];
size = (biWidth * biHeight) - 1;
pad = 4 - ((biWidth * 3) % 4);
// The following bug correction will cause the bitmap to be unrea... | 5 |
public boolean isCanceled() {
return canceled;
} | 0 |
@Override
public void update() {
super.update();
if(isActivated()) {
if(canFire)
{
//target the closest mob
Monster m = registry.getMonsterManager().getClosestWithinMax(getCenterPoint(), MAX_RANGE);
if(m != null) {
... | 5 |
public Engine getEngine() {
return engine;
} | 0 |
public static Result calcResult(int truePositives, int falsePositives,
int falseNegatives, int trueNegatives) {
double precision = truePositives / (float) (truePositives + falsePositives);
double recall = truePositives / (float) (truePositives + falseNegatives);
double fScore = 2 * ((precision * recall) / (pre... | 5 |
public final synchronized Character readCharacter(){
int ich = -1;
char ch = '\u0000';
Character wch = null;
try{
ich = input.read();
}catch(java.io.IOException e){
System.out.println(e);
... | 2 |
private static int findMidpoint(int hi, int lo) {
return lo + ((hi - lo) / 2);
} | 0 |
public Instruction findMatchingPop() {
int poppush[] = new int[2];
getStackPopPush(poppush);
int count = poppush[1];
Instruction instr = this;
while (true) {
if (instr.succs != null || instr.doesAlwaysJump())
return null;
instr = instr.nextByAddr;
if (instr.preds != null)
return null;
in... | 5 |
private ArrayList<OneMealData> findMatchedMeals(ArrayList<Canteen> canteens) {
ArrayList<OneMealData> matchedMeals = new ArrayList<OneMealData>();
//Not pretty at all!!
for (Canteen canteen : canteens) {
for (LineData lineData : canteen.getCanteenData().getLines()) {
if (!lineData.getLineName().equals("... | 6 |
public static byte menuAbrirCuentaClienteNuevo(){
byte op=0;
do{
try{
System.out.println("Cliente nuevo");
System.out.println("1. Abrir Cuenta Corriente");
System.out.println("2. Abrir Cuenta de Ahorro");
System.out.print("OP => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(Syst... | 3 |
public void putAll( Map<? extends Integer, ? extends Long> map ) {
Iterator<? extends Entry<? extends Integer,? extends Long>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Integer,? extends Long> e = it.next();
this.put( e.get... | 8 |
public static String showString() {
StringBuilder builder = new StringBuilder();
for (Argument arg : arguments.values()) {
builder.append(arg.toString());
builder.append("\n");
}
return builder.toString();
} | 1 |
static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} | 2 |
@Override
public void deletePosition(Position position) throws SQLException {
Connection dbConnection = null;
PreparedStatement preparedStatement = null;
String deletePosition = "DELETE FROM position WHERE id_position = '"
+ position.getId() + "'";
try {
dbConnection = PSQL.getConnection();
prepared... | 3 |
public void player1move(){
if (leftPressed)
{
if(!player1.offscreenleft)
{
player1.setX(player1.getX() - player1Speed);
}
} else if (rightPressed)
{
if(!playe... | 8 |
private void setupButtons() {
// Air button
String airText = VirusStatistics.isAirTransmission() ? "Air" : "Air ("
+ VirusStatistics.getAirTransmissionCost() + ")";
Color airColor = VirusStatistics.isAirTransmission() ? BUTTON_BUY_COLOR : BUTTON_COLOR;
airButton = new Button(20, 50, BUTTON_WIDTH, BUTTON_HEI... | 8 |
private void edgeCheck() {
Vector2D pos = gameObject.getPos();
switch(gameObject.getMoveDir()){
case MOVE_UP:
blockedCheck(pos.x, pos.y-delta*speed);
break;
case MOVE_DOWN:
blockedCheck(pos.x, pos.y+delta*speed);
break;
case MOVE_LEFT:
blockedCheck(pos.x - delta*speed, pos.y);
break;
case ... | 5 |
private static int ssIsqrt(int x)
{
if (x >= (SS_BLOCKSIZE * SS_BLOCKSIZE))
return SS_BLOCKSIZE;
final int e = ((x & 0xFFFF0000) != 0) ? (((x & 0xFF000000) != 0) ? 24 + LOG_TABLE[(x>>24) & 0xFF]
: 16 + LOG_TABLE[(x>>16) & 0xFF])
: (((x & 0x0000FF00) != 0) ? 8 + L... | 8 |
public synchronized void editar(int i)
{
try
{
new InstituicaoCooperadoraView(this, list.get(i));
}
catch (Exception e)
{
}
} | 1 |
public void handleInput(InputManager input)
{
// Move to the previous menu entry?
if (input.getMenuUp())
{
_SelectedEntry--;
if (_SelectedEntry < 0)
{
_SelectedEntry = _MenuEntries.size() - 1;
}
}
// Move to the next menu entry?
if (input.getMenuDown())
{
_SelectedEntry++;
if (_S... | 6 |
@Override
public String codonsOld() {
int numCodons = 1;
// Get CDS
String cdsStr = transcript.cds();
int cdsLen = cdsStr.length();
// Calculate minBase (first codon base in the CDS)
int minBase = codonNum * CodonChange.CODON_SIZE;
if (minBase < 0) minBase = 0;
// Calculate maxBase (last codon base ... | 4 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int times = 0;
int[] ids = new int[100001];
while ((line = in.readLine()) != null) {
if (times++ != 0)
line ... | 8 |
protected Point getCenterIntersection(State state1, State state2) {
return pointOnState(state1, angle(state1, state2));
} | 0 |
private void wczytajPaczke() {
//this.campaign = new Campaign();
String tempStr=getXML();
if(tempStr.equals(""))
return;
this.campaign.clearCampaign();
if(campaign.loadXml(tempStr))
{
NewQuizView.setCampaign(campaign);
} //projectTabPane.setCampaign(campaign);
projectTabPane.initiateGameFields();... | 2 |
public void renderElement(int pos, Graphics g) {
Polygon p = new Polygon();
switch (pos) {
case 0:
p.addPoint(0.5F, -0.5F);
p.addPoint(0.5F, 0);
p.addPoint(0.25F, 0);
p.addPoint(0.25F, -0.25F);
break;
... | 9 |
public void testGetField() {
MonthDay test = new MonthDay(COPTIC_PARIS);
assertSame(COPTIC_UTC.monthOfYear(), test.getField(0));
assertSame(COPTIC_UTC.dayOfMonth(), test.getField(1));
try {
test.getField(-1);
} catch (IndexOutOfBoundsException ex) {}
try {
... | 2 |
private String getAttributeValue(AXmlResourceParser parser, String attributeName) {
for (int i = 0; i < parser.getAttributeCount(); i++)
if (parser.getAttributeName(i).equals(attributeName))
return AXMLPrinter.getAttributeValue(parser, i);
return "";
} | 2 |
public Journal getByName(String name) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Journal.class);
criteria.add(Restrictions.eq("name", name));
return (Journal) criteria.uniqueResult();
} | 0 |
private Node firstIntersectionNode( Node node, K key ) {
if( node == null ) {
return null;
}
Node ret = null;
while( true ) {
if( mComp.compareMinToMax( key, node.mKey ) < 0 && mComp.compareMinToMax( node.mKey, key ) < 0 ) {
ret = node;
... | 9 |
public void setId(Integer id) {
this.id = id;
} | 0 |
public static Image applyMaskAndZeroCross(Image original, Mask mask,
int threshold) {
Image masked = applyMask(original, mask);
Image image = original.shallowClone();
if (original.isRgb()) {
zeroCross(masked, image, threshold, RED);
zeroCross(masked, image, threshold, GREEN);
zeroCross(masked, image, ... | 2 |
@Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld suppresshunger <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldName... | 5 |
public static PriceManager getInstance()
{
return instance;
} | 0 |
public synchronized void saveDataHeader(HashMap<String,String> metaInfo, Integer count){
//Hibernate Session creation.
Session session = HibernateUtil.getMetaSessionFactory().openSession();
Transaction txn = null;
//session.beginTransaction();
if(session != null){
... | 7 |
public void showText(Screen screen) {
if(option == OPTION.NONE) font.render(170, 35, -2, 0, "The Judgement", screen);
if(option == OPTION.ITEMS) font.render(215, 35, -4, 0, "Items", screen);
if(option == OPTION.EQUIPMENT) font.render(200, 35, -4, 0, "Equipment", screen);
if(option == OPTION.MAGIC) font.render(2... | 7 |
public void uzyskanieOdpNaPytanie_oRewanz()
{
boolean b_odpowiedz = false;
Object[] opcje = {"Tak","Nie"};
int odpowiedz = JOptionPane.showOptionDialog(widokWynikow, "Przeciwnik proponuje rewanż. Zgadzasz się?",
"Statki", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
null, opcje, opcje[0]);
... | 5 |
public void getRandom() {
//generate a temp value for the random;
int temp = 0;
if (!isVisible()) {
setVisible(true);
}
temp = getBpm() + r.nextInt(tolerance);
if (temp > max) {
BPM = getBpm() - r.nextInt(tolerance);
} else {
BP... | 2 |
public static int updateUserInfo(String uid, String u_name, String u_qq, String u_Email, String u_favourite,
String u_dis) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("update mstx_user set u_name=?, u_qq=?, u_Email=?, u_hobb... | 5 |
private int[] image2pixels(Image image)
{
int ai[] = new int[picsize];
PixelGrabber pixelgrabber =
new PixelGrabber(image, 0, 0, width, height, ai, 0, width);
try
{
pixelgrabber.grabPixels();
}
catch (InterruptedException interruptedexception)
{
... | 8 |
public void endGame(boolean plateauRempli) {
JLabel gagnantLabel = new JLabel("");
String text = null;
Couleur gagnant = jeu.getGagnant();
System.out.println("gagnant : "+gagnant.toString());
if (!plateauRempli) {
int pointsRestants=0;
for (int i=0;i<Plateau.PLATEAU_HEIGHT;i++) {
f... | 9 |
public boolean handleMainMenuInput(){
String userChoice;
boolean safeChoice = false;
boolean endGame = false;
while(!safeChoice){
System.out.print("Command: ");
userChoice = input.next();
if(userChoice.compareTo("Shop") == 0 || userChoice.compareTo("shop") == 0){
event = new Shop();
even... | 7 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
public int getUnsignedInt(int start, int offset) {
if (start < 0 || stringData.length() < (start + offset))
return stringData.charAt(0);
if (offset == 1) {
return stringData.charAt(start);
}
if (offset == 2) {
return ((stringData.charAt(start) & 0xFF)... | 5 |
protected synchronized void parserNode(Node node, WebPage wp) throws Exception {
if (node instanceof TextNode) {// 判斷是否是文本結點
// srb.addText(((TextNode) node).getText());
} else if (node instanceof Tag) {// 判斷是否是標籤庫結點
Tag atag = (Tag) node;
if (atag instanceof LinkTag) {// 判斷是否是標LINK結點
LinkTag linkatag =... | 5 |
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDatase... | 7 |
public boolean createChannel(Player p, String channelName) {
if(ChannelsConfig.getChannels().getConfigurationSection("channels").contains(channelName)) {
Messenger.tell(p, Msg.CUSTOM_CHANNELS_EXISTS);
return false;
}
ChannelsConfig.getChannels().createSection("channels." + channelName);
ChannelsConfig.g... | 1 |
public void updateModel()
{
//We don't allow reverse moves for the snake
boolean lateral = (lastDir == Direction.RIGHT && direction == Direction.LEFT)
|| (direction == Direction.RIGHT && lastDir == Direction.LEFT) ;
boolean vertical = (lastDir == Direction.UP && direction == Direction.DOWN)
|| (direction... | 8 |
@Override
public boolean addUser(User user)
{
/*
* we add a new unique user to UserDB
* if User name exist this function will return false
*/
{
Session session = null;
boolean succses = true;
try {
session = factory.openSession();
session.beginTransaction();
session.save(user);
s... | 3 |
public void setFullScreen(DisplayMode dm) {
JFrame f = new JFrame();
f.setUndecorated(true);
f.setIgnoreRepaint(true);
f.setResizable(false);
vc.setFullScreenWindow(f);
if (dm != null && vc.isDisplayChangeSupported()){
try {
vc.setDisplayMode(... | 3 |
private static Double castDouble(Object o) {
if (o == null) {
return null;
} else if (o instanceof Float) {
return (double) (Float) o;
} else if (o instanceof Double) {
return (Double) o;
} else if (o instanceof Byte) {
return (double) (Byt... | 6 |
@Test
public void TestaaTyhjaVasenAlanurkkaOikeaYlanurkka() {
rakentaja = new Kartanrakentaja(10, 6);
char[][] kartta = rakentaja.getKartta();
Solmu aloitus = new Solmu(kartta.length-1, 0);
Solmu maali = new Solmu(0, kartta[0].length-1);
Reitinhaku haku = new Reitinhaku(kartt... | 5 |
public void close() {
if(fos != null)
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
if(file != null)
file.delete();
if(initReq != null) {
String fileUID = initReq.getFileUID();
FileTransferClientCallBack cb = initReq.getGetFileCallBack();
printMessage("Signal ... | 9 |
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
if ((this.PFPanel.getSelectedIndex() == 0 || this.PFPanel.getSelectedIndex() == 1) &&
patientList.getSelectedIndex() >= 0 &&
e.getSource() == patientList) {
... | 9 |
private void createGUI() {
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel dataPanel = new JPanel(new MigLayout("fill, nogrid"));
receptionCodeLabel = new JLabel();
byRecordLabel = new JLabel();
serviceNameLabel = new JLabel();
serviceNameLabel.setBorder(BorderFactory.createEtchedBorder());
... | 8 |
@Override
public synchronized boolean delete(SyndicateFSPath path) throws FileNotFoundException, IOException {
if(path == null) {
LOG.error("path is null");
throw new IllegalArgumentException("path is null");
}
SyndicateFSPath absPath = getAbsolutePath(path);... | 8 |
private static String getName(int playerNum, String prevName){
String name;
while(true){
System.out.print("Player " + playerNum + " please enter your name.\n>> ");
name = scanner.nextLine().trim();
//if there is no spaces and it is not empty and names are not the same
if(!name.isEmpty() && !(nam... | 5 |
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
this.buttonPressed = true;
this.dragInitiated = true;
boolean anySelected = false;
Vector2 touchPos = new Vector2(screenX, 640 - screenY);
for(Character character : this.characters)
{
Vector2 characterCenterPos = new Ve... | 7 |
private Value search(Node x, Key key, int ht) {
Entry[] children = x.children;
// external node
if (ht == 0) {
for (int j = 0; j < x.m; j++) {
if (eq(key, children[j].key)) return (Value) children[j].value;
}
}
// internal node
el... | 6 |
public void DFS(int v) {
boolean[] visited = new boolean[vertice];
for (int i = 0; i < visited.length; i++) {
visited[i] = false;
}
for (int i = 0; i < vertice; i++) {
if (!visited[i])
DFSUtils(i, visited);
}
} | 3 |
public void timeCounter(){
try{
String strline;
while((strline=timeBr.readLine())!=null){
String[] s = strline.split("[-: ]+");
// s[0]:年, s[1]:月, s[6]:题号;
String time = s[0] + s[1];
if(timemap.containsKey(time))
timemap.put(time, timemap.get(time)+1);
else
timemap.put(time, 1);
... | 8 |
private void mettreAJourLePlateau(Position unePosition)
throws AucunPionARetournerExeption
{
ArrayList<Position> positionsDesCasesDesPionsAInverser = this
.obtenirPositionsDesCasesDesPionsAInverser(unePosition);
for (Position positionCourante : positionsDesCasesDesPionsAInverser)
{
this.plateau.obteni... | 1 |
public PolyLinje findKortasteGulaPolylinje(PolyLinje[] randomPolylinje)
{
// Går igenom array:en och kollar av varje
// polylinje om den är gul; om ja - kolla dess distans
// om inte fortsätt, gå igenom helt & behåll lägsta sträckan samt
// index till polylinjen och skriv ut dess info.
PolyLinje[] gulaPolyl... | 2 |
private boolean initFile(String filename) {
try {
File f = new File(filename);
if (!f.exists()) {
f.createNewFile();
}
File f2 = new File(filename);
if (f2.exists()) {
return true;
}
} catch (Exception e) {
log.severe(e.getMessage());
}
return false;
} | 3 |
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) throws VanishNotLoadedException {
Player player = event.getPlayer();
String newJoinMessage = "";
newJoinMessage += this.plugin.getConfig().getString("server.joinmessage");
newJoinMessage =... | 4 |
public static GameConnection getInstance(){
if(instance == null){
instance = new GameConnection();
}
return instance;
} | 1 |
protected DataTable addRows(Worksheet worksheet) {
DataTable dataTable = worksheet.getDatatable();
int width = dataTable.getColumnHeaders().size();
String[][] data = worksheet.getData();
//start on 6th line
for (int y = 5; y < data.length; y++) {
if(Helper.isNotBlank(data[y][0]) && data[y][0].matches... | 7 |
protected Instances process(Instances instances) throws Exception {
Instances result;
int i;
int n;
double[] values;
String value;
Instance inst;
Instance newInst;
// we need the complete input data!
if (!isFirstBatchDone())
setOutputFormat(determineOutputFormat(getInput... | 8 |
public String getListaCodigosDisciplinas(List<Disciplina> lista) {
String listaCodigo = "";
for (int k = 0; k < lista.size(); k++) {
listaCodigo += lista.get(k).getCodigo();
if (k != lista.size() - 1) {
listaCodigo += ",";
}
}
return listaCodigo;
} | 2 |
@Override
public String getListOfRecommendations() {
String sql = SELECT_PROJECTS_FOR_TRAINING;
List<Position> positions = new ArrayList<Position>();
ResultSet resultSet = null;
Statement statement = null;
Connection connection = new DbConnection().getConnection();
try {
statement = connection.createSta... | 7 |
private void computeOneOverlap(Overlappable overlappable,
Vector<Overlap> overlaps) {
Area overlappableArea, targetArea;
Rectangle boundingBoxTarget, boundingBoxOverlappable;
Shape intersectShape = intersectionComputation(overlappable);
overlappableArea = new Area(intersectShape);
boundingBoxOverlappable... | 8 |
protected void input(String string) {
controller.initialize(string);
} | 0 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
Player player = null;
if (sender instanceof Player)
{
player = (Player) sender;
}
if(ModGod.debug){ModGod.log.info("onCommand");}
if (cmd.getName().equalsIgnoreCase("... | 8 |
private boolean interfaceIsSelected(RSInterface rsInterface) {
if (rsInterface.conditionType == null)
return false;
for (int c = 0; c < rsInterface.conditionType.length; c++) {
int opcode = parseInterfaceOpcode(rsInterface, c);
int value = rsInterface.conditionValue[c];
if (rsInterface.conditionType[c] ... | 9 |
public Object setStateParameterValue(String key, Object value) {
int index = -1;
for (int i = 0; i < parameterKeys.length; i++) {
if (key.equals(parameterKeys[i])) {
index = i;
break; // exit loop
}
}
// Check if card could be found
if (index < 0) {
return null;
} // else return the found ... | 5 |
public void deregister() throws ClientDeregisterFailureException, ClientDoesNotExistException {
try {
_out.writeInt(8); //Size
_out.writeInt(Response.MSG_CLIENT_DEREGISTER);
_out.writeInt(_clientId);
_out.flush();
int messageType = _in.readInt();
... | 4 |
public static int[] getDirection(int x1, int y1, int x2, int y2) {
int[] returnvalue = new int[2];
int UP = calulateUpDistance(x1, y1, x2, y2);
int RIGHT = calulateRightDistance(x1, y1, x2, y2);
int DOWN = calulateDownDistance(x1, y1, x2, y2);
int LEFT = calulateLeftDistance(x1, y1, x2, y2);
int X = Math.... | 8 |
public void fetchAll() throws Exception {
running = true;
lastRequestStart = new AtomicLong(System.currentTimeMillis());
activeThreads = new AtomicInteger(0);
spinWaiting = new AtomicInteger(0);
fetchQueue = new FetchQueue();
configQueue = new ConfigQueue();
Ar... | 8 |
static public Point[] find2CirclesIntersections(final Point c1, final double r1,
final Point c2, final double r2) {
if (r1 < 0 || r2 < 0)
return null;
Point[] result = null;
if (r1 == 0 || r2 == 0){
... | 7 |
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.