text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Head getHeadByName(String name){
for(Head u : allHeads){
if(u.getName() == name){
return u;
}
}
return null;
} | 2 |
private void regenerateContent()
{
StringBuilder sb = new StringBuilder();
switch(view)
{
case NOTES:
{
List<Note> notes = mon.getNotes();
content = "";
for(Note n : notes)
{
sb.append... | 8 |
public Queue<String> dobleAgenteXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... | 9 |
protected void processWindowEvent(
WindowEvent event )
{
if (event.getID() == WindowEvent.WINDOW_CLOSING)
{
actionCancel();
}
super.processWindowEvent(event);
} | 1 |
private void lexicalAnalysis(String sourceCode) {
lexer = new EsperLexer(new ANTLRStringStream(sourceCode));
lexerSuccess = (lexerErrors = lexer.getNumberOfSyntaxErrors()) <= 0;
//Print output
if (flagLexerOutput) {
System.out.println("Lexer output: ");
Token token;
EsperLexer tokensOut = new EsperL... | 3 |
public static MultipleChoiceQuestion getQuestionByQuestionID(int questionID) {
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, questionID);
ResultSet rs = stmt.executeQuery();
... | 1 |
public void reservedItem()
{
int tjek = 0;
for (int i = 0; i < orderlistWithDate.size(); i++)
{
for (int j = 0; j < orderlistWithDate.get(i).getItemlist().size(); j++)
{
for (int k = 0; k < itemlistReserved.size(); k++)
{
... | 5 |
@Test
public void add_test() {
try{
double [][]mat1= {{1.0,2.0}, {3.0,1.0}};
double [][]mat2= {{2.0,1.0}, {1.0,3.0}};
double [][]result = Matrix.add(mat1, mat2);
double exp[][]={{3.0,3.0}, {4.0,4.0}};
Assert.assertEquals(result, exp);
}
catch (Exception e) {
// TODO Auto-generated catch block
... | 1 |
public List<TravelDataBean> getBoardCommentaryList(int idx) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
List<TravelDataBean> commList = null;
String sql = "";
TravelDataBean comm = null;
try{
conn = getConnection();
sql = "select * from travelcomme... | 9 |
private long locateIP(byte[] ip) {
long m = 0;
int r;
// 比较第一个ip项
readIP(ipBegin, b4);
r = compareIP(ip, b4);
if (r == 0) return ipBegin;
else if (r < 0) return -1;
// 开始二分搜索
for (long i = ipBegin, j = ipEnd; i < j; ) {
m = getMiddleOff... | 7 |
public long getCrc32() {
return crc32.getValue();
} | 0 |
public static Side toSide( EndPointPosition position ){
switch( position ){
case LEFT: return Side.WEST;
case RIGHT: return Side.EAST;
case TOP: return Side.NORTH;
case BOTTOM: return Side.SOUTH;
default: throw new IllegalArgumentException();
}
} | 4 |
private void calculateEnabledState(JoeTree tree) {
if (tree.getComponentFocus() == OutlineLayoutManager.ICON) {
setEnabled(true);
} else {
if (tree.getCursorPosition() == tree.getCursorMarkPosition()) {
setEnabled(false);
} else {
setEnabled(true);
}
}
} | 2 |
public boolean func_48135_b(EntityAnimal par1EntityAnimal)
{
if (par1EntityAnimal == this)
{
return false;
}
else if (!this.isTamed())
{
return false;
}
else if (!(par1EntityAnimal instanceof EntityWolf))
{
return fa... | 6 |
public BreakBlock(BreakableBlock breaksBlock, boolean needsLabel) {
this.breaksBlock = (StructuredBlock) breaksBlock;
breaksBlock.setBreaked();
if (needsLabel)
label = breaksBlock.getLabel();
else
label = null;
} | 1 |
public void checkOldGoals() {
LinkedList<Formula> temp = new LinkedList<Formula>();
Formula f;
while(!proven && !incompleteGoals.isEmpty()) {
f = incompleteGoals.poll();
Boolean clear = false;
for(Goal g : f.possibleGoals) {
if(inKnowledge(g.directGoals)) {
clear = true;
try {
Dedu... | 9 |
public void paste(String destinationPath) {
System.out.println("Paste requested to : " + destinationPath);
File destination = new File(destinationPath);
if (!destination.isDirectory()) {return;}
//If it is a new paste, we restart the queue stats
if (!busy) {
this.queueTotalSize = 0;
this.queueCurr... | 6 |
protected void onUserList(String channel, User[] users) {} | 0 |
public void depthFirstTraversal()
{
boolean[] visited;
visited = new boolean[gSize];
for (int index = 0; index < gSize; index++)
visited[index] = false;
for (int index = 0; index < gSize; index++)
if (!visited[index])
dft... | 3 |
protected final static Logger getLogger() {
return LoggerFactory.getLogger(ConfigManager.class);
} | 0 |
@Override
public boolean activate() {
return (!Bank.isOpen()
&& !validate(Constants.WAITFOR_WIDGET)
&& !Widgets.get(13, 0).isOnScreen()
&& Inventory.contains(Settings.itemOneID)
&& Settings.usingHerb
);
} | 4 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((msg.amITarget(this)
||((msg.tool()==this)&&(msg.target() instanceof Container)))
&&((getPackageFlagsBitmap()&PACKAGE_FLAG_TO_ITEMS_PROGRAMMATICALLY)==0)
&&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_DRO... | 9 |
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = new File(CONFIG_FILE);
configuration = YamlConfiguratio... | 2 |
private void resize() {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (getSkinnable().isKeepAspect()) {
if (aspectRatio * wi... | 6 |
public void visit_i2c(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} | 1 |
public static void OBRADI_odnosni_izraz(boolean staviNaStog){
String linija = mParser.ParsirajNovuLiniju();
int trenLabela = mBrojacLabela++;
if (linija.equals("<aditivni_izraz>")){
OBRADI_aditivni_izraz(staviNaStog);
return;
}
if (linija.equals("<odnosni_izraz>")){
OBRADI_odnosni_izraz(true);... | 7 |
public DiscreteUniform(int low, int high) throws ParameterException {
if (low < 1 || high <= low) {
throw new ParameterException("DiscreteUniform parameters a in N, b > a.");
} else {
this.low = low;
this.high = high;
unif = new ContinuousUniform(low, high + 1);
}
} | 2 |
public boolean ComboBad( int col, int row, int val ) {
// check the row
for (int n = 0; n < 9; n++ ) {
if ( _board[row][n] == val ) {
System.out.println("Oops, there is already a " + val + " in row " + converter( row ) );
System.out.println("Try again!");
pause( 1 );
return true;
}
}
// check t... | 7 |
private boolean checkTimer(String currentWeapon){
if (currentWeapon.equals("MachineGun")){
if (machineTimer < 0){
machineTimer = 10;
return true;
} else {return false;}
} else if (currentWeapon.equals("Pistol")){
return true;
}else if (currentWeapon.equals("Crowbar")){
... | 9 |
public static void main(String[] args)
{
double[] a = new double[6];
int[] m = new int[6];
int s=0;
obrobka.test(args, a);
//
for (int i = 0; i < 6; i++){
int x = (int) a[i];
double y = a[i] - x;
if (y!=0){
s++;// , ;
... | 6 |
static void merge(int[] leftArray, int[] rightArray, int[] newArray) {
int i = 0, j = 0, k = 0;
int leftLength = leftArray.length;
int rightLength = rightArray.length;
// Compare left and right and put the smaller value in the new array
while(i < leftLength && j < rightLength) {
if(leftArray[... | 6 |
@Override
public void addRow(IRow row) {
Sheet sheet = wb.getSheet(row.getSheetName());
if (sheet == null) {
sheet = wb.createSheet(row.getSheetName());
}
final int lastRow = sheet.getLastRowNum();
Row r = sheet.getRow(lastRow);
if (r == null) {
... | 4 |
private void go(){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
HashMap<Integer, HashMap<Integer, Integer>> g = new HashMap<Integer, HashMap<Integer, Integer>>();
int[] dist = new int[n+1];
for(int i=1;i<=n;i++){
dist[i]=Integer.MAX_VALUE;
g.put(i, new Hash... | 3 |
public MakingOffer makeOffer(Offer offer, PlayerPtrVector allPlayers,
News news) {
// called by CheckBuying() of own team, or by GUI
if (offer.getPlayer().getContracts().getNextContr().getTeam() != null
|| offer.getBuyer().equals(offer.getPlayer().getContracts().getCurrContr()
.getTeam())) {
// has ... | 9 |
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
// TODO add your handling code here:
liceu.Administrator admin = new liceu.Administrator(usernameElev.getText(), parolaElev.getText(),ncElev.getText(),cnpElev.getText(),"Elev",(String)clasaE... | 5 |
public void toXML(){
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document out = docBuilder.newDocument();
Element rootElem = out.createElement("bill");
out.appendChild(rootElem);
for (Device dev... | 4 |
public static void main(String[] args) throws FileNotFoundException {
String masterName = "masterServer";
String masterAdd = args[0];
int masterPort = new Integer(args[1]);
String dir = args[2];
File metaData = new File("metaData.txt");
File repServers = new File("repServers.txt");
TreeMap<String, Replica... | 5 |
public static String timeIntervalToString(long millis) {
StringBuffer sb = new StringBuffer();
if (millis < 10 * Constants.SECOND) {
sb.append(millis);
sb.append("ms");
} else {
boolean force = false;
String stop = null;
for (int ix = 0... | 7 |
public Object showEduFwContent() {
String cmd = "show;eduframework";
ArrayList<String> list = null;
String[][] content = null;
try {
NetService client = initNetService();
client.sendCommand(cmd);
list = client.receiveList();
client.shutDownConnection();
content = new String[list.size()][];
if ... | 7 |
public void createPlanetsPanel() {
planetsPanel.setLayout(new GridLayout(2, 2));
JPanel OU = new JPanel(); // OU Start
OU.setLayout(new BoxLayout(OU, BoxLayout.Y_AXIS));
JLabel OUPic = new JLabel(new ImageIcon("Icons/OU2.png"));
OUPic.setAlignmentX(CENTER_ALIGNMENT);
OU.add(OUPic);
JLabel OUTitleLabel = ... | 8 |
public int getZ(){
return zPos;
} | 0 |
public static int getSpace(int i){
switch (i) {
case 1: return space[0][0];
case 2: return space[0][1];
case 3: return space[0][2];
case 4: return space[1][0];
case 5: return space[1][1];
case 6: return space[1][2];
case 7: return space[2][0];
... | 9 |
public void writeToAdjacencyList(ArrayList<Node> network, String file){
try
{
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write("#Number of nodes:\n" + network.size() + "\n");
out.write("#Node degrees:\n");
for(int i=0;i<network.siz... | 5 |
public Level(String ID, String level){
this.ID = ID;
path = level;
loadLevel(level);
} | 0 |
public void inserir(long pesquisaId, ArrayList<InstituicaoCooperadora> instituicoesCoopreadoras) throws Exception
{
String sql = "INSERT INTO Pesquisainstituicoes_cooperadoras(id1, id2) VALUES(?, ?)";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
for (Instit... | 2 |
public static void main(String[] args) {
try {
int test = 0;
int rowsA = 10;
int colsA = 10;
int rowsB = colsA;
int colsB = rowsA;
String fileNameOfMatrixA = "A" + rowsA + "x" + colsA + ".txt";
String fileNameOfMatrixB = "B" + ... | 4 |
public String getLabelState() {
if (state == DECONNECTED)
return "Déconnecté";
return "Connecté";
} | 1 |
public void shuffle()
{
//System.out.println("Shuffling");
cardsInDeck=cards.clone();
PlayingCard[] cardsNotInPlay=new PlayingCard[cardsInDeck.length];
int cardsOutofPlay=0;
for (PlayingCard c: cards)
{
if(c.placeInDeck())
{
cardsNotInPlay[cardsOutofPlay++]=c;
}
}
cardsInDeck=new PlayingCa... | 3 |
public static String textForFirstTag(Element element, String tag) {
if (!element.hasChildNodes())
return ""; // Should never happen if we are passed a valid Element
// node
NodeList tagList = element.getChildNodes();
int tagCount = tagList.getLength();
if (0 == tagCount) // No tags
return "";
fo... | 7 |
public void stateChanged(ChangeEvent c) {
JSlider s = (JSlider) c.getSource();
if (s == speed) {
Game.gamedata.set_bpm(speed.getValue());
speedL.setText("Speed: " + speed.getValue() + " bpm");
} else if (s == diff) {
Game.gamedata.set_difficulty(diff.getValue());
if (diff.getValue() <= 1) {
System... | 6 |
public Triple initFile(String fileName, String lang){
com.hp.hpl.jena.graph.Node s = NodeFactory.createURI("http://bla.example.com");
com.hp.hpl.jena.graph.Node p = NodeFactory.createURI("http://bla.example.com/#a");
com.hp.hpl.jena.graph.Node o = NodeFactory.createLiteral(String.valueOf(Math.random()*100));
Tr... | 1 |
private boolean requestCredentialsAndAuthenticate(Callback[] callbacks) throws LoginException
{
boolean authenticated = false;
try
{
callbackHandler.handle(callbacks);
username = ((NameCallback) callbacks[0]).getName();
password = loadPassword((PasswordC... | 4 |
@Override
public Object getParent(Object element) {
if (element instanceof IFile) {
IFile file = (IFile) element;
return file.getProject();
} else if (element instanceof String) {
String task = (String) element;
return this.taskToFileMap.get(task);
} else if (element instanceof AliasTask) {
AliasT... | 3 |
private void checkRight(TetrominoMoveSelector moves, Tetromino tetromino, int x, int y) {
//Si on est pas entrain de sortir de l'écran
if(x + tetromino.getWidth() >= width || y == -1){
moves.removeTranslateRight();
}else {
//Block nommé pour sortir de la boucle imbriquée... | 8 |
public static void setLongBE(final byte[] array, final int index, final long value, final int size) {
switch (size) {
case 0:
return;
case 1:
Bytes.setInt1(array, index, (int)value);
break;
case 2:
Bytes.setInt2BE(array, index, (int)value);
break;
case 3:
Bytes.setInt3BE(array, index... | 9 |
@Override
public int hashCode() {
int result = creationTime != null ? creationTime.hashCode() : 0;
result = 31 * result + (groupName != null ? groupName.hashCode() : 0);
result = 31 * result + (lastAccessTime != null ? lastAccessTime.hashCode() : 0);
result = 31 * result + (lastModifiedTime != null ? ... | 9 |
public void build(String type, Tile location) {
if (mana.hasEnough(costs.get(type)) && location.getConstruct()==null && (!updater.getGameState().equals("win") &&
!updater.getGameState().equals("lose"))) {
Construct construct = null;
if(type.equals("tower") && location.getType().equals("FieldTile")) {... | 8 |
@Override
public boolean keyDown(int keycode) {
while (keyNotDown) {
if (MOVE_KEYS.containsKey(keycode)) {
final Direction dir = MOVE_KEYS.get(keycode);
if (dir.getXis().equals("HORIZONTAL")) {
player.setXD(dir.getSpeed());
} else if (dir.getXis().equals("VERTICAL")) {
player.setYD(dir.getSp... | 8 |
static final boolean method2203(byte i) {
int i_1_ = 11 % ((12 - i) / 53);
anInt4802++;
try {
return Class348_Sub42_Sub8_Sub2.parseIncomingPacket(true);
} catch (java.io.IOException ioexception) {
Class272.method2049(106);
return true;
} catch (Exception exception) {
String string
= ("T2 - "
... | 7 |
public Direction directionContaining(Point p){
if(backWall.contains(p)) return forwardDir;
if(backDirRect.contains(p)) return backDir;
if(rightWall.contains(p)) return forwardDir.getRightDirection();
if(leftWall.contains(p)) return forwardDir.getLeftDirection();
return null;
} | 4 |
private static int getuid(String s) {
try {
File file = new File(s + "uid.dat");
if (!file.exists() || file.length() < 4L) {
DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(s + "uid.dat"));
dataoutputstream.writeInt((int) (Math.random() * 99999999D));
dataoutputstream.c... | 4 |
public void insertTrainer(Trainer trainer){
//insert entry
int id = insertNamedEntity(trainer, "TRAINER");
//map its characteristics
// this.insertIntoTableAllValues(
// "entity_caracteristic",
// id,
// 9,//PASSWORD
// ... | 7 |
private boolean reachBlockerByMaxGeneric(keyMap key, int maxReach,int max,int option) {
if(mapReachBlockerByMaxDate.size() >= intMaxMapSize){
mapReachBlockerByMaxDate.clear();
}
if (mapReachBlockerByMaxDate.containsKey(key)) {
long elapsedTime = 0;
switch (opt... | 8 |
public void updateProfile( Profile p ) {
ArrayList<AchievementRecord> newAchRecs = new ArrayList<AchievementRecord>();
newAchRecs.addAll( p.getAchievements() );
for ( Map.Entry<Achievement, JCheckBox> entry : generalAchBoxes.entrySet() ) {
String achId = entry.getKey().getId();
JCheckBox box = entry.getVal... | 3 |
boolean isReferenceAttributeTypeDifferent(ConfigurationObjectReference configurationObjectReference, ReferenceAttributeType referenceAttributeType) {
if(_configurationImport.getConfigurationData(referenceAttributeType, getAttributeGroup("atg.objektReferenzAttributTypEigenschaften")) == null) {
return true;
}
// ... | 9 |
public static double getRate(String c1, String c2){
Connection conn = DBase.dbConnection();
PreparedStatement dbpst;
double dr =0;
try{
String query = "Select Rate FROM "+c1+ " where CountryCode = ?";
dbpst=conn.prepareStatement(query);
dbpst.setString(1,... | 2 |
public void testWithFieldAdded3() {
DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
test.withFieldAdded(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
@Override
public Query rewrite(IndexReader reader) throws IOException {
if(!termLongEnough) { // can only match if it's exact
return new TermQuery(term);
}
int maxSize = BooleanQuery.getMaxClauseCount();
PriorityQueue<ScoreTerm> stQueue = new PriorityQueue<ScoreTerm>();
FilteredTermEnum en... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JuliaAlgorithm other = (JuliaAlgorithm) obj;
if (base == null) {
if (othe... | 9 |
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[]) {
AppartamentoClass casa1 = new AppartamentoClass();
AppartamentoClass casa2 = new AppartamentoClass();
String casa1_name = new String();
String casa2_name = new String();
casa1_name = "Casa 1";
casa2_name = "Casa 2";
// Popolo Casa 1
casa1.leggiInput(... | 6 |
private byte[] pdf() {
// Make Nonce 16 bytes by prepending zeroes. done (see init())
// one AES invocation is enough for more than one PDF invocation
// number of index bits needed = 1
// Extract index bits and zero low bits of Nonce
BigInteger Nonce = new BigInteger(1, nonce);
in... | 5 |
private Object sql(Method method, Object[] args, Sql annotation) throws Exception {
Connection c = connector.connect();
try {
try {
PreparedStatement st = statement(args, annotation, c);
Class ret = method.getReturnType();
if (ret != Void.TYPE)... | 3 |
public void close() throws BitstreamException
{
try
{
source.close();
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
} | 1 |
public int exprHashCode() {
if (value != null) {
return 10 + value.hashCode();
}
return 10;
} | 1 |
void parseDoctypedecl() throws java.lang.Exception
{
char c;
String doctypeName, ids[];
// Read the document type name.
requireWhitespace();
doctypeName = readNmtoken(true);
// Read the ExternalIDs.
skipWhitespace();
ids = readExternalIds(false);
... | 7 |
@Override
public String valueToString(Object value) throws ParseException {
LengthValue length = (LengthValue) value;
if (mBlankOnZero && length.getValue() == 0) {
return ""; //$NON-NLS-1$
}
return length.toString();
} | 2 |
private boolean createIndex(Connection connection) throws SQLException {
if (connection == null) {
throw new SQLException("You must establish a connection before creating the indexes");
}
Statement stmt = null;
try {
Run.addProcessStatus("Creating the database indexes");
String [] inde... | 2 |
public void renderProjectile(int xp, int yp, Projectile p) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < p.getSpriteSize(); y++) {
int ya = y + yp;
for (int x = 0; x < p.getSpriteSize(); x++) {
int xa = x + xp;
if(xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break;
... | 8 |
private String findName(String response, String elementTag, String elementType) throws Exception{
Document doc = RestClient.stringToXmlDocument(response);
NodeList list = doc.getElementsByTagName(elementTag);
for(int i=0; i < list.getLength();i++){
if(list.item(i).getAttributes().getNamedItem(Constants.TYP... | 2 |
private static void validarCNPJ(String digits) throws ValidacaoException {
try {
boolean isvalid = false;
if (Long.parseLong(digits) % 10 == 0) {
isvalid = somaPonderadaCNPJ(digits) % 11 < 2;
} else {
isvalid = somaPonderadaCNPJ(digits) % 11 ==... | 3 |
private void parseMethodNameAndParameters() {
methodName = method.getName();
for(Class<?> parameterClass: method.getParameterTypes()) {
parameterTypes.add(parameterClass.getSimpleName());
}
} | 2 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... | 8 |
private void createDNAOutput(){
U.p("Max memory used during this run was: " + Driver.getMaxMem() + " GB");
//Create a header for the output file
annoHeader = "##Modified by annotationAlignmenttool on: " + sdf.format(Calendar.getInstance().getTime()) + "\n" + "##Modified from original to fit: " + DNAFile.substr... | 7 |
protected void parseFeatures() {
// Empty?
if (featuresStr.length() <= 0) return;
String type = null;
String value = "";
StringBuilder values = new StringBuilder();
int lineNum = 0;
for (String line : featuresStr.toString().split("\n")) {
lineNum++;
// Feature start
if (isNewFeature(line)) {
... | 6 |
public static void main(String[] args) {
try {
int res;
res = ToolRunner
.run(new Configuration(), new WrokBench(), args);
System.exit(res);
} catch (Exception e) {
e.printStackTrace();
}
} | 1 |
public void add(int newx, int newy, int newz) {
if (_level == null)
return;
if (_level.getTile(newx, newy, newz).getVisableBlock() == this.getVisableBlock())
return;
_level.setTile(this, newx, newy, newz, _server);
Player.GlobalBlockChange((short)newx, (short)newy, (short)newz, this, _level, _server, fals... | 2 |
public UDPChat() throws SocketException
{
new InterfaceSelector(this);
new IncomingListener(this);
} | 0 |
public static void main(String[] args) {
System.out.print("Enter ten numbers: ");
Scanner scanner = new Scanner(System.in);
int[] numbers = new int[10];
int distinctNumberCounter = 0;
for (int i = 0; i < numbers.length; i++) {
int number = scanner.nextInt();
int arrayIndex = 0;
for (arrayIndex = 0; a... | 5 |
@SuppressWarnings({ "unchecked", "rawtypes" })
private static final Object[] decodeDictionary(byte[] bencoded_bytes, int offset) throws BencodingException
{
HashMap map = new HashMap();
++offset;
ByteBuffer info_hash_bytes = null;
while(bencoded_bytes[offset] != (byte)'e')
{... | 8 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
jFTFTelefone = new javax.swing.JFormattedTextField();
... | 4 |
public void endLog() {
end = "\t<end date=\"" + getLogDate() + "\" time=\"" + getLogTime() + "\" />\n";
logfilename = "log/log_" + formatDateTime("dd-MM-yyyy_HH-mm") + ".xml";
try {
JFileChooser fc = new JFileChooser("log/");
fc.setFileFilter(new XMLFileFilter());
fc.setSelectedFile(new File(logfilename)... | 7 |
public void majFen(ArrayList<Message> message){
if (message.size() > 0){
for(Message tmp:message){
//System.out.println (tmp);
jTextArea3.setText(jTextArea3.getText()+tmp.toString());
}
try {
chat.nettoyerMessage(this.getPseudo(... | 3 |
public void act()
{
if(Greenfoot.mousePressed(this)) {
startX = getX();
startY = getY();
}
//Enables the checker to respond to mouse drags
//Only moves the checker to diagonal posisitons
if(Greenfoot.mouseDragged(this)) {
MouseInfo mous... | 9 |
@Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
session.put("User", null);
session.clear();
myDao.getDbsession().close();
addActionMessage("Successfully Logged Out.");
re... | 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 |
private void loadEmployeeDateFromFile(String staffRepository) {
InputStream is = getInputStreamForFile(staffRepository);
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
try {
XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(is);
while (xmlEventReader.hasNext())... | 5 |
public int[] diceThrown() {
switch (turn % 5) {
case 1 :
return new int[] { 2, 3 };
case 2 :
return new int[] { 4, 4 };
case 3 :
return new int[] { 3, 6 };
case 4 :
return new int[] { 6, 1 };
case 0 :
return new int[] { 5, 3 };
default :
... | 5 |
protected boolean siirraVaakasuunnassa(int napinKorkeus, int napinLeveys, int suunta) {
if ((suunta == 1 && napinLeveys + 1 >= getLeveys()) || (suunta == -1 && napinLeveys - 1 < 0) ) {
return false;
}
if (getLauta()[napinKorkeus][napinLeveys + suunta].getTunniste() == -1) {
... | 5 |
private void init(){
Random rand = new Random(System.currentTimeMillis());
for (int x = 0; x < Standards.CHUNK_SIZE; x++){
for (int y = 0; y < Standards.CHUNK_SIZE; y++){
int tileX = (chunkX * Standards.CHUNK_SIZE) + x;
int tileY = (chunkY * Standards.CHUNK_SIZE) + y;
contents[x][y] = new Tile(2,... | 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.