text stringlengths 14 410k | label int32 0 9 |
|---|---|
public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) {
List<InetAddress> hosts = new ArrayList<InetAddress>();
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
while (true) {
DatagramPacket packet ... | 7 |
protected ProtocolPacket[] receivePacket(Tcp tcp, Ip4 ip)
throws InvalidPacketProtocolParserException,
UnknownPacketProtocolParserException,
UnknownPartTypeProtocolParserException {
// since only clients starts connections, we can use this to match the
// client IP and it is not necessary to ask the user w... | 9 |
public SAXCodeAdapter(final ContentHandler h, final int access) {
super(h);
labelNames = new HashMap();
if ((access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE | Opcodes.ACC_NATIVE)) == 0)
{
addStart("code", new AttributesImpl());
}
} | 1 |
public void setBounds(int x, int y) {
setBoundsDoor(x, y);
if (direction == 1) {
doorBounds.x = x;
doorBounds.y = y;
}
if (direction == 2 || direction == 3) {
doorBounds.x = x;
doorBounds.y = y;
}
} | 3 |
public void repaintNewTheme()
{
char currentDirection = this.direction;
String directionString=null;
switch(currentDirection)
{
case 'v': directionString = "down"; break;
case '^': directionString = "up"; break;
case '>': directionString =... | 4 |
public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int ... | 6 |
public <T extends Interactive & Locatable> boolean combineCamera(final T entity, final int pitch) {
if (!entity.valid()) {
return false;
}
if (entity.inViewport()) {
return true;
}
final Thread angleThread = new Thread(new Runnable() {
@Override
public void run() {
ctx.camera.turnTo(entity);... | 4 |
public Topic parseTopic(Document dom) throws ParserConfigurationException, SAXException, IOException, XMLStreamException {
Topic topic = new Topic();
if(dom.getElementsByTagName("num").item(0).getFirstChild() != null){
String[] nums = dom.getElementsByTagName("num").item(0).getFirstChild().getNodeValue().... | 4 |
@SuppressWarnings("resource")
private void executaComando(String escolha) {
try {
Scanner linha = new Scanner(escolha.toLowerCase());
int cmd = converterComando(linha.next());
if (!linha.hasNext())
throw new Exception(
"COMANDO INCOMPLETO: esta faltando o segundo atributo");
String s = linha.... | 8 |
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!obj.getClass().isAssignableFrom(Vec.class)) return false;
Vec other = (Vec) obj;
return x == other.x && y == other.y && z == other.z;
} | 4 |
private void pollInput() {
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
log.dbg("Key pressed: SPACE");
}
}
}
} | 3 |
public static boolean isTypePrimitive(Class<?> type) {
return (type != null && type.isPrimitive());
} | 2 |
public static void question2() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("Do you feel like dressing fancy?");
questionNumberLabel.setText("2");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
radioBut... | 0 |
public void move() {
lastX = x;
lastY = y;
/* If we can make a decision, pick a new direction randomly */
if (isChoiceDest()) {
direction = randomDirection();
}
/* If that direction is valid, move that way */
switch (direction) {
case 'L'... | 9 |
public Game(){
startGame();
} | 0 |
@Override
public void validarSemantica() {
Tipo cond=null;
try {
cond =expr1.validarSemantica();
} catch (Exception ex) {
Logger.getLogger(SentenciaWhile.class.getName()).log(Level.SEVERE, null, ex);
}
if(cond instanceof TipoBooleano){
Sente... | 5 |
public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
numSteps--;
return;
}
numSteps++;
if (!hasCollided(xa, ya)) {
if (ya < 0)
movingDir = 0;
if (ya > 0)
... | 7 |
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 schrijf()
throws DbException{
// Create a XMLOutputFactory
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter;
try {
eventWriter = outputFactory
.createXMLEventWriter(new FileOutputStream(handler.getBestand()));
} catc... | 4 |
public ClassST parse() throws UnexpectedTokenException, SyntaxError
{
ClassST ret = null;
String _package = this._package();
List<String> imports = this.imports();
String signature = this.classSignature();
String name = this.getToken().data;
Type type = Type.parse(signature.toString());
this.nextToken(... | 3 |
public static void main(String[] args) throws InterruptedException {
BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(1);
Runnable runnable = new Runnable() {
@Override
public void run() {
System.out.println("r1 running");
try {... | 2 |
public static void main(String[] args) {
Random gen = new Random();
for (int times = 0; times < 1000; ++times) {
int n;
if (args.length == 1) {
n = Integer.valueOf(args[0]);
} else {
n = gen.nextInt(100) + 1;
}
List<Integer> A = rand_vector(n);
int pivot_index = gen.nextInt(A.size());
... | 8 |
public boolean fireMedium(TableroDos enemy, int x, int y){
if(this.respaX!=0 && this.respaY!=0 && this.pasa){
return this.fireHard(enemy, x, y);
}
else if(enemy.shipMap[x][y]!=" " && this.map.fireMap[x][y]!="x" && this.map.fireMap[x][y]!="o"){
this.map.fireMap[x][y]="x"; ... | 7 |
@Override
public void testFinished(Description description) {
if (hasPassed()) {
final Xpp3Dom testCase = getCurrentTestCase();
testCase.addChild(createResult(TestState.passed));
testCase.addChild(createNotes(String.format("'%s' PASSED.", description.getDisplayName())));
... | 1 |
public void run() {
while (true) {
Object obj = receive();
if (obj instanceof ICamera)
deportedClient.update((ICamera) obj);
else if (obj instanceof IObject)
deportedClient.update((IObject) obj);
}
} | 3 |
public void writeXml(DataCompiler p, String namefile) {
String to = System.getProperty("user.dir"); // recupero el directorio del proyecto
String separator = System.getProperty("file.separator"); //recupero el separador ex: Windows= '\' , Linux='/'
to = to + separator + "src" + separator + "src"... | 1 |
*/
private void ionChange(boolean isChange) {
// Cookie情報用リスト
ArrayList<String> valueList = new ArrayList<String>();
for (Iterator i=isIonRadio.keySet().iterator(); i.hasNext(); ) {
String key = (String)i.next();
boolean before = (boolean)isIonRadio.get(key);
boolean after = ((JRad... | 5 |
public JTextField getjTextFieldCP() {
return jTextFieldCP;
} | 0 |
@EventHandler
public void SkeletonPoison(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.getZombieConfig().getDouble("Skeleton.Pois... | 7 |
@Override
public String get(int start, int end) {
StringBuilder sb = new StringBuilder(end-start+10);
Feature f = null;
int pos = start;
//Find the first overlapped structure variant.
int SVOffset = findFirstOverlappedSV(start, end);
if (SVOffset<0)
SVOffset = 0;
for (int i=SVOffset; i<s... | 9 |
public static int parseMultiplier(String value) {
value = value.toLowerCase();
if (value.contains("b") || value.contains("m") || value.contains("k")) {
return (int) (Double.parseDouble(value.substring(0, value.length() - 1))
* (value.endsWith("b") ? 1000000000D : value.en... | 6 |
@PUT
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public TaskList modify(@PathParam("id") int id,
@FormParam("title") @DefaultValue("null") String title,
@FormParam("list_id") @DefaultValue("0") int list_id) {
if (OwnershipDatabase.userOwnsTask(
(String) sr.getA... | 5 |
private String extractSessionKey() {
StringBuilder sb=new StringBuilder();
int a,o;
sb.append("Session Key is ");
for (a=44;a<(44+70);a=a+7) {
o=extractIntFromStart(a);
if (checkITA3Char(o)==true) {
sb.append("0x");
if (o<16) sb.append("0");
sb.append(Integer.toHexString(o)+" ");
}
else ... | 3 |
public void handleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow)
{
EntityPlayerSP var2 = this.mc.thePlayer;
switch (par1Packet100OpenWindow.inventoryType)
{
case 0:
var2.displayGUIChest(new InventoryBasic(par1Packet100OpenWindow.windowTitle, par1Packet10... | 6 |
public final Instruction getNextByAddr() {
if (nextByAddr.opcode == opc_impdep1)
return null;
return nextByAddr;
} | 1 |
@Override
public void controleEtAjoute(Entretien entretien) throws ValidationException {
if (entretien == null) {
throw new ValidationException("L'entretien est invalide");
}
if (entretien.getDescription() == null || !StringValidation.VerifString(entretien.getDescription())) {
... | 7 |
public static String GameChoice()
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// Ask for user input
PrintSeparator('#');
System.out.println("Welcome To The Checkers Game developed by:");
System.out.println(" \t1. Ashish Prasad ashishp@... | 6 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
ChatPlayer cp = plugin.getChatPlayer(sender.getName());
ArrayList<String> channelList = cp.getChannels();
String current =... | 6 |
public static byte linear2ulaw(int sample) {
int sign, exponent, mantissa, ulawbyte;
if (sample>32767) sample=32767;
else if (sample<-32768) sample=-32768;
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0) sample = -sample; ... | 6 |
public CoffeescriptEditor() {
colorManager = new ColorManager();
setDocumentProvider( new CoffeescriptDocumentProvider() );
setSourceViewerConfiguration(new CoffeescriptConfiguration( colorManager ));
} | 0 |
public RouterWorker(Socket clientSocket) {
this.clientSocket = clientSocket;
Setup.println("[RoutingService.run] Conexion abierta desde: " + clientSocket.getInetAddress().getHostAddress());
} | 0 |
@Test
public void testDelete() {
fail("Not yet implemented");
} | 0 |
public static void main(String args[]) {
try {
if (args.length > 1) {
printUsage();
return;
}
PS3TestDriver td;
if (args.length == 0) {
td = new PS3TestDriver(new InputStreamReader(System.in),
... | 5 |
private void varDecl(boolean global) throws Exception
{
Type type = typeDecl(global);
Identifier varName = ident();
env.put(varName, defaultVariableValue(varName));
env.putType(varName, type);
while(scan.sym == Token.comma) {
scan.next();
varName = ide... | 2 |
public DefaultMutableTreeNode LoadDLLImport(DefaultMutableTreeNode IMPORT,VraReader b)
{
//get the phisical address to data drectory array links to dll import table
int pos2=((int)DataDir[2]);
System.out.println("DLL RVA ARRAY POSITION "+pos2+"");
Vector<JTable> v1=new Vector<JTable>();
//for dll names
Vector<Str... | 6 |
public Interface(BufferedImage bg, Sprite sprite)
{
this.bg = bg;
this.sprite = sprite;
this.cX = Game.fieldWidth;
this.cY = Game.fieldHeight;
buttonMap = new HashMap<>();
barMap = new HashMap<>();
selectColor = new Color(255, 255, 255, 128);
line1 = l... | 1 |
protected final void loadHandlers() {
for (Method m : this.getClass().getMethods()) {
InternalTask itask = m.getAnnotation(InternalTask.class);
if (itask == null)
continue;
Class<?> handledClass = itask.type();
if (handledClass == null)
... | 7 |
@Override
public int getAge() {
return age;
} | 0 |
public List<Client> searchClient(String usernameOrName) {
Connection conn=null;
try{
conn = dbConnector.getConnection();
if (conn==null) //cannot connect to DB
return null;
Statement st;
ResultSet rs;
String sql;
boolean searchAll = false;
if (usernameOrName==null )
searchAll=tr... | 9 |
private static void rsaDecrypterFile(CryptobyConsole console) {
// Input Path to File for decryption
scanner = new Scanner(System.in);
System.out.println("Enter Path to File for Decryption (Type '" + quit + "' to Escape):");
scanner.useDelimiter("\n");
if (scanner.hasNext(quit))... | 8 |
private Node decide() {
char c = input.charAt(offset);
if (c == '(') {
offset++;
return parseDecision();
}
else if (c == '[') {
offset++;
return parseRange();
}
else {
return parseLiteral(true);
}
} | 2 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
MOB diseaser=invoker;
if(diseaser==null)
diseaser=mob;
if((!mob.amDead())&&((... | 7 |
public synchronized void fileWriter(Quiz quiz)throws RemoteException{
String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
File file = new File(filePath);
Set<Question> questionListForNewQuiz=new HashSet<Question>();
BufferedWriter bufferedWriter = null;
//BufferedWriter bufferedWriterForQuest... | 3 |
public void setPlayer1Piece(JLabel label) {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: setPlayer1Piece() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: setPlayer1Piece() - END");
m_player1Piece = label;
} | 4 |
private void validarDatos(String usuario, String contrasenha) throws BusinessException {
String mensaje = "";
if(usuario == null || usuario.isEmpty())
mensaje += "El usuario no puede ser nulo o vacio\n";
if(contrasenha == null || contrasenha.isEmpty())
mensaje += "La cont... | 5 |
public void menu() {
String s;
Boolean exit = false;
Integer option = null;
while (!exit) {
UI.printHeader();
System.out.println("Selecciona una opción a continuación:");
System.out.println("1) Editar servicios");
System.out.println("2) Editar agentes");
System.out.println("3) Editar conexiones... | 7 |
private void updatePosition(Entity entity) {
int timePassed = entity.tickStart - tick;
int differenceX = entity.startX * 128 + entity.boundaryDimension * 64;
int differenceY = entity.startY * 128 + entity.boundaryDimension * 64;
entity.x += (differenceX - entity.x) / timePassed;
entity.y += (differenceY - ent... | 4 |
public PercolationStats(int N, int T) {
if (T <= 0) {
throw new IllegalArgumentException("Provided number of experiments (" + T + ") is not positive.");
}
if (N <= 0) {
throw new IllegalArgumentException("Provided size (" + N + ") is not positive.");
}
if (Integer.MAX_VALUE / N < N) {
... | 5 |
private void costruisciDamiera() //si occupa della costruzione della damiera del pannello.
{
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
{
damieraGrafica[i][j]=new Quadrato(damiera, i, j);
this.add(damieraGrafica[i][j]);
aggiungiListener(i, j, damieraGrafica[i][j]);
}
try //una volta costrui... | 8 |
public Piece getDarkKing(Tile[][] board, boolean isWhite)
{
Piece darkKing = null;
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
//If the space isn't null
if(board[j][i] != null && board[j][i].getPiece() != null)
{
//Get a piece with the name "K" (which should be a king)
... | 6 |
public TreeRow getFirstRow() {
List<TreeRow> children = mRoot.getChildren();
if (!children.isEmpty()) {
return children.get(0);
}
return null;
} | 1 |
private static void diffImages(BufferedImage goodImage, PixImage studentPixImage) {
BufferedImage studentImage = ImageUtils.pixImage2buffer(studentPixImage);
int diffCount = 0;
System.out.println("The difference is:");
if (studentImage.getWidth() != goodImage.getWidth()) {
System.out.println("The ... | 8 |
public TabButton(DataTabButton data) {
this.data = data;
setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_ACTIVE_HEIGHT));
setMinimumSize(getPreferredSize());
setMaximumSize(getPreferredSize());
setLayout(null);
setOpaque(false);
... | 5 |
public void setExp(){
hero.setExperience(hero.getExperience() + 3);
} | 0 |
public int getComboBox4 () {
if (jComboBox4.getSelectedIndex() == 0) return 70;
else if (jComboBox4.getSelectedIndex() == 1) return 75;
else if (jComboBox4.getSelectedIndex() == 2) return 80;
else if (jComboBox4.getSelectedIndex() == 3) return 85;
return 90;
} | 4 |
private void updateButton() {
// [srk] same protection added to updateColors
// make sure node is not null
if (node == null) {
return ;
} // end if
if (node.isAncestorSelected()) {
button.setSelected(true);
} else {
button.setSelected(false);
}
if (node.isLeaf()) {
button.setNode(false... | 4 |
@Override
public void addColumn(TableColumn column) {
super.addColumn(column);
switch (getColumnCount()) {
case 1:
column.setPreferredWidth(400);
break;
case 2:
column.setPreferredWidth(80);
break;
c... | 8 |
@Override
public void run() {
init();
while(running){
tick();
render();
try{
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} | 2 |
public void disegnaAlbero(AlberoBin<Integer> a) {
if (a != null) {
altezzaAlbero = altezza(a);
setPreferredSize(new Dimension(NodoGrafico.WIDTH * Mat.pow(2, altezzaAlbero),
(altezzaAlbero + 1) * 3 * NodoGrafico.HEIGHT / 2 + 20));
assegnaNodiGrafici(a);
} else nodiGrafici.clear();
repaint();
select(... | 1 |
public boolean addToPrintQueue(GCode code,boolean manual){
if(!state.connected){
// cons.appendText("Not connected");
try {
Thread.sleep(500); //test only
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
if(manual && state.printi... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HostAndPort other = (HostAndPort) obj;
if (addr == null) {
if (other.addr... | 7 |
public static List<Dependency> applyIgnoreRules(List<Dependency> dependencies, Set<DependencyRule> ignoreRules) {
if (dependencies == null) {
return null;
}
List<Dependency> result = new ArrayList<Dependency>();
for (Dependency dependency: dependencies) {
if (depe... | 3 |
private void bfsTravel(TreeNode root, int level, List<List<Integer>> result){
Queue<TreeNode> maintain = new LinkedList<TreeNode>();
Queue<TreeNode> visited = new LinkedList<TreeNode>();
List<Integer> list = null;
TreeNode tmp = null;
maintain.offer(root);
while(!maintai... | 5 |
public Object nextEntity(char ampersand) throws JSONException {
StringBuilder sb = new StringBuilder();
for (; ; ) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... | 5 |
private void leaveEssenceMine() {
if (Util.inEssenceMine() && !Players.getLocal().isMoving()) {
if (Util.walkToAndClick("Enter", Util.portalId)) {
int time = 0;
while (Util.inEssenceMine() && time <= 4000) {
time += 50;
Time.sleep(50);
}
}
}
} | 5 |
public void showAll()
{
Graphics g = null;
long startTime = 0;
long endTime = 0;
int timeToSleep = 1000 / framesPerSec;
for (int i = 0; i < imageList.size(); i++)
{
startTime = System.currentTimeMillis();
this.currIndex = i;
g = this.getGraphics();
draw(g);
g.dis... | 3 |
public void paintComponent(Graphics g) {
// probably draws the tiles
for(int i = 0; i < tilesHeight; i++) {
for(int j = 0; j< tilesWidth; j++) {
g.drawImage(tiles.get(tilesWidth*i + j), j*50, i*50, null);
}
}
////////////////////ACTUAL TREASURES////////////////////////////////
for (int i = 0; i <... | 6 |
private int jjMoveStringLiteralDfa0_1()
{
switch(curChar)
{
case 10:
return jjStopAtPos(0, 6);
default :
return 1;
}
} | 1 |
public static GsArtist[] parseArtists(String data,Gs parent) {
Pattern re=Pattern.compile("\\{result:\\[(.*)\\}");
Matcher m=re.matcher(data);
GsArtist[] res=new GsArtist[1];
if(!m.find()) {
res[0]=null;
return res;
}
String realData=m.group(1);
int size=0;
int pos=0;
for(;;) {
in... | 6 |
public String getName() {
return this.name;
} | 0 |
private String formatDoubleValue(double d)
{
String s;
if(Math.abs(d) > 1000)
{
s = " kJ";
d = d/1000;
if (Math.abs(d) > 1000)
{
s = " MJ";
d = d/1000;
if (Math.abs(d... | 3 |
public boolean baca(String kode_buku){
boolean adaKesalahan = false;
Connection cn = null;
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+ex... | 6 |
public void setDepartmentId(int departmentId) {
this.departmentId = departmentId;
} | 0 |
public static void main(String args[]) {
Color first = Color.black;
Color second = Color.red;
Comparator comp = new ColorComparator();
// //System.out.println(comp.compare(first, second));
} | 0 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
private ReportDefinition getReportDefinitions(Element documentRootElement) {
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportDirectory(AppConstants.REPORT_DIRECTORY);
reportDefinition.setReportType(ReportType.Both);
try {
NodeList reportList = documentRootElement
... | 8 |
public int getFunctionStartLine() {
return environmentStack.peek().getStartLineNumber();
} | 0 |
public int getRoadSpeed(int city1, int city2) {
for (int i = 0; i < roads.size(); i++) {
String[] s = (String[]) roads.get(i);
int c1 = Integer.valueOf(s[0]);
int c2 = Integer.valueOf(s[1]);
int spd = Integer.valueOf(s[2]);
if ((c1 == city1) && (c2 == ... | 5 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((flag == null) ? 0 : flag.hashCode());
result = prime * result + foundationYear;
result = prime * result + idTournament;
... | 5 |
static long [] getChunkByOffset(int []vsize, int []csize, long offset)
{
long []start = new long[vsize.length];
int [] volume = new int [vsize.length];
volume[0]=1;
for(int i = 1; i < volume.length; i++)
{
volume[i] = volume[i-1]*vsize[i-1];
}
int dsize = 1;
for(int i = volume.length - 1; i >... | 3 |
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if("exit".equals(cmd)) {
setVisible(false);
} else if("start".equals(cmd)) {
setVisible(false);
owner.startBattle();
} else if("add".equals(cmd)) {
addRobot(availableRobotList.getSelectedIndex());
} else if(... | 7 |
public int kmeans(Data data) throws OutOfRangeSampleSize{
int numberOfIterations = 0;
C.initializeCentroids(data);
boolean changedCluster=false;
do{
numberOfIterations++;
changedCluster = false;
for(int i=0; i<data.getNumberOfExamples(); i++){
Cluster nearestCluster = C.nearestCluster(data.g... | 5 |
public void drawCMaps(Graphics g)
{
Rectangle r = getBounds();
int elements = data3d.GetNumElements();
int elem = data3d.GetActiveElement();
double sizex = (r.width-1)/(double) elements;
int sizey = (r.height-1)/ 4;
for (int e=0;e < elements;e++)
{
for (int y=... | 8 |
public void update(){
if(happen){
/* ウィンドウ更新 */
mes_window.update();
command_window.update();
/* 敵とエフェクト更新 */
enemy.update();
effect_manager.update();
/* 状態遷移 */
final STATE st = this.now_state;
if(this.mes_window.get_printing_message()) return;//メッセージ表示中は戦闘を進めない
... | 9 |
@Override
public Role createRole(Role role) {
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_INSERT_ROLE,
new String[] { "role_id" });
... | 5 |
public int numOwned() {
int ret = 0;
final String tag = getTag();
for (int i = 1; /* loop until broken */; i++) {
GenericObject prov = dataSource.getProvince(i);
if (prov == null)
break;
if (prov.getString("owner").equals(tag))
... | 3 |
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 static void main(String[] args)
{
int i;// only used in first loop. Other variables are declared in the for statements
Scanner keyboard = new Scanner(System.in);
do{
System.out.println();
System.out.print("Enter a positive integer that is no greater than 15: ");
i = keyboard.nextInt();
if(i ... | 6 |
public boolean canJump(int[] A) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int maxr = 0;
int i = 0;
while (i < A.length) {
maxr = A[i];
if (A[i] == 0 && i < A.length-1) return false;
if (i+A[i] >= A.length... | 8 |
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.