text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static int nLoseCoords(List<Poi> oldPoiList, List<Poi> newPoiList){
HashMap<String, Poi> newPoiMap = new HashMap<String, Poi>();
for (Poi new_poi : newPoiList) {
newPoiMap.put(new_poi.getId(), new_poi);
}
int cnt = 0;
for(Poi old_poi : oldPoiList){
if(old_poi.hasCoord()){ // old POI has coords
... | 5 |
public void setMax(){
if(type == "dirt"||type == "stone"||type == "grass"){
maxCount = 200;
}
else if(type == "metal"||type == "wood"){
maxCount = 100;
}
else{
maxCount = 25;
}
} | 5 |
public static String putPieceOnTop(Cube cube, TileColor c) {
String a = "";
TileColor color = TileColor.get(getPos(cube, c)[0]);
TileColor other = TileColor.get(Cube.getOthers(getPos(cube, c)).get(0)[0]);
if (eitherEquals(color, other, TileColor.blue) && eitherEquals(color, other, TileColor.red)) {
a = ",R,U... | 8 |
public static void saveStream(NbtCompound source, OutputSupplier<? extends OutputStream> stream, StreamOptions option) throws IOException {
OutputStream output = null;
DataOutputStream data = null;
boolean suppress = true;
try {
output = stream.getOutput();
... | 4 |
String getOPTConfiguration(int[][] input){
initState();
for (int pi = 0;pi<permutations.length;pi++){
int currentMoveCount = 0;
for (int bno=0;bno<_NO_OF_BINS;bno++){
int allowedType = permutations[pi][bno];
for(int btype = 0; btype<_BOTTLE_TYPES;btype++){
if (allowedType!=btype){
cu... | 8 |
public World tick() {
Cell[][] newState = new Cell[world.getWidth()][world.getHeight()];
for( int i = 0; i < world.getWidth(); i++) {
for( int j = 0; j < world.getHeight(); j++) {
if(world.getCellAt(i, j) == Cell.DEAD) {
if (world.numberOfAdjacentLivingCells(i, j) == 3) {
newState[i][j] = Cell.LIV... | 6 |
public static void main(String[] args) throws Exception
{
ServerSocket sers = new ServerSocket(5001);
Socket socket = sers.accept();
InputStream ins = socket.getInputStream();
OutputStream os = socket.getOutputStream();
byte[] buffer =new byte[200];
int length =0;
while(-1 != (leng... | 1 |
public void setSynchronized(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int mod = methodInfo.modifiers();
if (flag) {
mod |= Modifiers.SYNCHRONIZED;
} else {
mod &= ~Mod... | 2 |
@Test
public void testSeveralRulesWithRepeat() {
base.addRules(rules,rules1,rules2,rules3,rules4,rules5,rules6);
List<String> result1 = base.matchEventToRules("documentEvent");
Assert.assertEquals(result1.size(),3);
Assert.assertTrue(result1.contains("http://www.rules.org/action1") &&
... | 9 |
public static Disc recommendDiscForHole(Bag bag, Hole hole) {
LOGGER.log(Level.INFO, "Populating criteria for hole '" + hole.getHoleNumber() + "' to recommend a disc.");
Map<String, Object> criteria = new HashMap<String, Object>();
int distance = hole.getDistance();
if (distance < PUTT_MAX_DIST) { criteri... | 8 |
public static void main(String[] args) {
if(args.length == 3) {
int hours = -1, start = -1, end = -1;
try {
hours = Integer.parseInt(args[0]);
start = Integer.parseInt(args[1]);
end = Integer.parseInt(args[2]);
} catch(Throwable t) {
System.out.println("One of the arguments was not a number")... | 9 |
@Override
public T read(Object value) {
String stringValue = String.valueOf(value);
try {
return Enum.valueOf(enumType, stringValue);
} catch (IllegalArgumentException e) {
}
try {
return Enum.valueOf(enumType, stringValue.toUpperCase());
} c... | 5 |
public void update (float delta) {
lastShoot += delta;
if (lastShoot >= timeBetweenShoots) {
lastShoot = 0;
bodies.add(createBody(WeaponType.Circle));
}
} | 1 |
public PlayerListener(Arena arena) {
this.parentarena = arena;
} | 0 |
public long ping() {
if (connection == null) return -1;
try {
long start = System.currentTimeMillis();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("[Redis][Ping][try to ping server:" + start + "]");
}
RedisResult result = handler.request(new ProtoBuilder().array(Protocol.Command.PING)... | 7 |
public final String format() {
final String indent = this._indent_;
final List<Object> items = this._items_;
final StringBuilder string = this._string_;
final int size = items.size();
for (int i = 0; i < size;) {
final Object item = items.get(i++);
if (item == Mark.EMPTY) {
final FEMFormatter.Mark t... | 7 |
public void removeActionListener(ActionListener l) {
if(l == null) {
return;
}
actionListener = null;
} | 1 |
private DataInstance getHistory(int card, boolean forDraw){
boolean use_prob = forDraw ? USE_PROB_DRAW : USE_PROB_PLAY;
DataInstance d = new DataInstance(nodeCount(forDraw, true));
//Rack
d.addFeature(rack.getCards(), game.card_count);
//Probabilities
if (use_prob){
double[][] prob = rack.getProbabiliti... | 2 |
public static Connection getConnexion () throws BDException {
Connection conn = null;
try {
Properties p = new Properties();
InputStream is = null;
is = new FileInputStream("connection.conf");
p.load(is);
String url = p.getProperty("url");
String driver = p.getProperty("driver");
String login =... | 3 |
public void process() {
Item[] items = player.getEquipment().getItems().getItems();
for (int slot = 0; slot < items.length; slot++) {
Item item = items[slot];
if (item == null)
continue;
if (player.getAttackedByDelay() > Utils.currentTimeMillis()) {
int newId = ItemConstants.getDegradeItemWhenComba... | 7 |
public final WaiprParser.localstat_return localstat() throws RecognitionException {
WaiprParser.localstat_return retval = new WaiprParser.localstat_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token ID58=null;
CommonTree ID58_tree=null;
RewriteRuleTokenStream stream_ID=new RewriteRuleT... | 4 |
private static void consolidateComputerConfigs(GameStatus gameStatus) {
Logger.info("Consolidating files");
File[] allFiles = FileManager.listAllFiles(gameStatus);
ArrayList<ComputerPlay> computers = new ArrayList<ComputerPlay>();
int counter = 0;
for(File file:allFiles) {
if(counter%50 == 0) Logger.info("... | 9 |
public static JsonResponse addCare(String src, String target, String displayName) {
JsonResponse resp = new JsonResponse(NOK, String.format("Error: Invalid request"));
//OR by email
User srcUser = User.find("byPhoneNumber", src).first();
//OR by email
User targetUser = User.find("byPhoneNumber", target).fi... | 8 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
switch (value) {
case 1:
Graphics2D g1 = (Graphics2D) g;
g1.drawOval(28, 25, 49, 49);
g1.setPaint(new Color(0, 128, 0));
g1.fillOval(28, 25, 49, 49);
g1.setPaint(new Color(255, 255, 255));
g1.drawOval(45, 42, 15, 15);
g1.setP... | 9 |
public static void main(String[] args) throws IOException {
if (args[0].equals("--help") || args[0].equals("-h")) {
System.out.println("Turing machine simulator, configured by a file which must be given in the form:\n"+
"\n"+
"<begin>\n"+
"/The content of the task, it\n"+
"/will be discharged at\n"+ ... | 8 |
protected Direction checkForDirt(Creature c){
Sensor s = c.getSensor();
for (Direction d : Direction.values()){
int value = (int) s.getSense(d.name() + DirtBasedAgentSenseConfig.TYPE_SUFFIX).getValue();
if (value == Environment.DIRT){
return d;
}
}
return null;
} | 2 |
@Override
public Point getTarget(GameState state) {
List<Point> candidates = new ArrayList<Point>();
Unit[][] grid;
switch(gridChoice) {
case OURS:
grid = state.getOurGrid();
break;
case THEIRS:
grid = state.getTheirGrid();
break;
default:
throw new ImpossibleException();
}
for(int x ... | 9 |
protected void install(final ModModel modModel) throws Exception {
final IMod mod = modModel.getMod();
final IUpdate u = modModel.getSelectedUpdate();
final FullVersion v = u.getVersion();
out(Localization.translate("UpdaterDialogBase.install.installing",
mod.getName(), v));
if (modModel.isInstalled()) {
... | 7 |
public void loadFromFile(String file, World world) {
File f = new File("plugins/placereplacer/saves/" +world.getName() + "/" +file + ".fr");
if (!f.exists()) {
return;
}
try {
GZIPInputStream gzipi = new GZIPInputStream(new FileInputStream(f));
DataInputStream in = new DataInputStream(gzipi);
this.l... | 2 |
public Matrix4f Mul(Matrix4f m)
{
Matrix4f res = new Matrix4f();
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
float acc = 0.0f;
for (int k = 0; k < 4; k++)
acc += matrix[i][k] * m.GetElement(k, j);
res.SetElement(i, j, acc);
}
}
matrix = res.GetMatri... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CachedResource<T> other = (CachedResource<T>) obj;
if (this.resource ... | 5 |
public static void main(String[] args){
Scanner clavier = new Scanner (System.in);
int choix;
double temperatureAconvertir;
double reponse;
char recommencer;
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("CONVERTISSEUR DEGRES CELSIUS ET DEGRES FAHRENHEIT");... | 8 |
public boolean remove(int key) {
// Knuth, v. 3, 527, Algorithm R.
int i = indexOf(key);
if (!_filled[i]) {
return false;
}
--_n;
for (; ;) {
_filled[i] = false;
int j = i;
int r;
do {
i = (i - 1)... | 9 |
private PageComboBox createComboBox() {
PageComboBox cb = new PageComboBox();
cb.setPage(page);
if (uid != null) {
cb.setUid(uid);
uid = null;
}
connect(cb);
if (actionName != null) {
cb.setName(actionName);
actionName = null;
}
if (selectedIndex > 0) {
cb.putClientProperty("... | 8 |
protected void attackEntity(Entity var1, float var2) {
float var3 = this.getEntityBrightness(1.0F);
if(var3 > 0.5F && this.rand.nextInt(100) == 0) {
this.entityToAttack = null;
} else {
if(var2 > 2.0F && var2 < 6.0F && this.rand.nextInt(10) == 0) {
if(this.onGround) {
... | 6 |
public void resaveParamsSaveHotel(SessionRequestContent request) {
String currCountry = request.getParameter(JSP_CURR_ID_COUNTRY);
if (currCountry != null && !currCountry.isEmpty()) {
request.setAttribute(JSP_CURR_ID_COUNTRY, currCountry);
}
String currCity = request.getParam... | 4 |
static final void method388(int i, int i_18_, int i_19_,
Class318_Sub1_Sub5 class318_sub1_sub5,
Class318_Sub1_Sub5 class318_sub1_sub5_20_) {
Class357 class357 = Class348_Sub46.method3321(i, i_18_, i_19_);
if (class357 != null) {
((Class357) class357).aClass318_Sub1_Sub5_4395
= class318_sub1_sub5;
... | 7 |
public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
size.visit(visitor);
} else {
size.visit(visitor);
}
} | 1 |
public double[][] multiplicarMatrizes(double[][] multiplicadora,double[][] multiplicando){
if(multiplicadora[0].length != multiplicando.length){
System.err.println("O tamanho das matrizes não são compatíveis");
return null;
}
double[][] resultadoTemp = new double[multiplicadora... | 6 |
AbstractNode simpleExpr() {
AbstractNode node;
if (test(MINUS)) {
read(MINUS, "-");
node = new NegationNode(term());
} else {
node = term();
}
while (test(PLUS) || test(MINUS)) {
if (test(PLUS)) {
read(PLUS, "+");
node = new BinOpNode(PLUS_OP, node, term());
} else if (test(MINUS)) {
... | 5 |
static boolean test2(int val) {
System.out.println("test2(" + val + ")");
System.out.println("result: " + (val < 2));
return val < 2;
} | 0 |
public boolean deleteTestOrders(Connection con)
{
boolean didItWork = true;
ArrayList<Integer> onos = new ArrayList(); //Indeholder ordrenumre på testordre
String SQLString1 = "SELECT ordreno FROM ordre WHERE kundeno = 1";
String SQLString2 = "DELETE FROM ordredetails WHERE ... | 8 |
private void executaJogada() throws FileNotFoundException, IOException, ClassNotFoundException {
String move = leitor.nextLine();
if (move.compareToIgnoreCase("save") == 0)
{
FileOutputStream fos = new FileOutputStream("default.xdz");
ObjectOutputStream oos = new... | 9 |
public void showNextSlide() {
if(slideList.get(slidePanel.currentSlide.getSlideID()).getLastSlide()==false){
int nextSlideID = slidePanel.currentSlide.getSlideID() + 1;
Slide nextSlide = slideList.get(nextSlideID);
slidePanel.refreshSlide(nextSlide);
previousSlideButton.setBorderPainted(true);
if(slidePa... | 2 |
public Board generateRandom(int size, double limitProb)
{
AState[][] map = new AState[size][size];
map[0][0] = new AState(0,0, false, true, false);
map[size-1][size-1] = new AState(size-1, size-1, false, false, true);
for(int i = 0; i < size; i++)
{
for(int j = 0; j < size; j++)
{
if(i == 0 && j... | 6 |
public int getSize() {
return size;
} | 0 |
public void roll(PinCount knockOverCount) throws Exception {
if (status == FrameStatus.FINISHED) {
throw new AlreadyFrameFinishedException();
}
Integer knockOverPinCount = knockOverCount.intValue();
if (score + knockOverPinCount > IConstants.PIN_PER_FRAME) {
if (!isFinalFrame()) {
throw new PinCountR... | 7 |
public static boolean isContextFreeGrammar(Grammar grammar) {
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (!ProductionChecker.isRestrictedOnLHS(productions[k]))
return false;
}
return true;
} | 2 |
public void keyPressed(KeyEvent e)
{
int code = e.getKeyCode();
if(code == P)
{
keyP = true;
}
if (code == R1 || code == R2)
{
rightKey = true;
dir = RIGHT;
}
if (code == L1 || code == L2)
{
le... | 9 |
public TreeNode findTreeNode(String pathlabel,TreeNode start)
{
TreeNode targetNode=null;
TreeNode current= start;
if(current.getPathLabel().equals(pathlabel))
{
targetNode=current;
}
else
{
if(current.hasChild()==true)
{
Hashtable<Character, TreeNode> ... | 4 |
@Override
public Course assignRoleSchoolToCourse(long roleId, long courseId) {
RoleSchool specificRole = null;
for(Person person : persons){
List<RoleSchool> roles = (ArrayList<RoleSchool>)person.getRoles();
for(RoleSchool role : roles){
if(role.ge... | 5 |
public Token next()
{
if(eof)
return new Token(Kind.EOF, "", nextReadLineNumber, nextReadColumnNumber - 1);
while(emittedTokens.size() == 0)
{
int rawValue = readChar();
if(rawValue < 0)
{
eof = true;
value = Character.MIN_VALUE;
}
else
{
value = (char)rawValue;
}
... | 3 |
@Override
public void run() {
while (running){
int px_xPan = 0;
int px_yPan = 0;
int px_xDir = 0;
int px_yDir = 0;
if (leftHeld){
px_xPan -= 2;
px_xDir -= 1;
}
if (rightHeld){
px_xPan += 2;
px_xDir += 1;
}
if (upHeld){
px_yPan -= 2;
px_yDir -= 1;
}
if (downHel... | 9 |
public String getUserId() {
return userId;
} | 0 |
public String getData(int row, int col) {
if (row < 0
|| col < 0
|| row > (getRowsCount() - 1)
|| col > (getColsCount() - 1)) {
return null;
}
try {
Vector theRow = (Vector)m_fileContent.get(row);
String result = (String)theRow.get(col);
r... | 6 |
private void setLayerNeuronInputs(ArrayList<Double> currentInputsX, int layerIndex, int exampleIndex, boolean printInfo){
if(printInfo){
//System.out.println("Setting inputs for Layer : " + layerIndex);
}
ArrayList<Perceptron> currentLayer = getLayerNeurons(layerIndex, false);
if(layerIn... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Loop other = (Loop) obj;
if (header == null... | 9 |
public void mostrarProductosTabla(){
GestionarProducto gp = new GestionarProducto();
productos=gp.selectAllProducto();
DefaultTableModel modelo = (DefaultTableModel)tablaProd.getModel();
for(int i=0;i<productos.size();i++){
modelo.addRow(new Object[]{i+1,productos.get(i).getI... | 1 |
protected static String apostrophesToBoldTag(String text) {
pattern = Util.WIKI_BOLD;
do {
matcher = pattern.matcher(text);
text = matcher.replaceFirst("<b>");
matcher = pattern.matcher(text);
text = matcher.replaceFirst("</b>");
} while (text.cont... | 1 |
public static List<DeviceSummary> getDeviceSummaries() throws JSONException {
List<DeviceSummary> deviceSummaries = new ArrayList<DeviceSummary>();
// Get the string IDs of all the switches and create switch summary
// objects for each one
try {
Future<Object> devices = Deserializer.readJsonArrayFromURL("h... | 6 |
public void powerAttack(Vector2 target){
if(powerCoolDown!=0 || knockedOut) return;
if(aiming && aimTime>aimMax)
superAttack();
else{
aimTime = 0;
switch (powerType){
case DARKMAGIC:
case ELECTRO:
case FIRE:
case ICE:
case ROCK:
main.addObject(shoot(target));
powerCoolDown = DEFAU... | 9 |
@Override
public boolean wipeTable(String table) {
Connection connection = open();
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error at Wipe Table: table, " + table + ", does not exist", true);
return false;
}
statement = connection.cr... | 5 |
@Override
protected Msg xrecv (int flags_) {
// If there's already a message prepared by a previous call to zmq_poll,
// return it straight ahead.
Msg msg_;
if (has_message) {
msg_ = new Msg(message);
has_message = false;
more = msg_.has_more();
... | 7 |
public PdfSubByteSampleModel(int w, int h, int numComponents, int bitsPerComponent)
{
super(DataBuffer.TYPE_BYTE, w, h, numComponents);
assert bitsPerComponent < 8 : "This is designed just for use with per-component sizes of less than 8 bits; " +
"you should probably use PixelInterle... | 3 |
public static void main(String[] args) {
ColorPalette drawingColor = ColorPalette.GREEN;
System.out.println("Saving color setting");
try {
ObjectOutputStream os = new ObjectOutputStream(
new FileOutputStream("color.dat"));
os.writeObject(drawingColor);
os.close();
ObjectInputStream is = new Obje... | 2 |
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return Integer.class;
case 1:
return String.class;
case 2:
return String.class;
case 3:
return String.cl... | 6 |
public void paint(Graphics g2) {
for (int i = 0; i < blocks.length; i++) {
for(int j = 0; j < blocks[i].length; j++){
int x = blocks[i][j].getBounds().x;
int y = blocks[i][j].getBounds().y;
ArrayList<Image> currentImages = blocks[i][j].getImages();
if(currentImages == null){
... | 4 |
public int getId() {
return id;
} | 0 |
private void printParkingLot(StringBuffer buf, int parkId) {
buf.append("<div style=\"width:40px;height:240px;float:left\">\n");
// vertical space
buf.append("<div style=\"width:40px;height:40px\"></div>\n");
// right light
if (parkId != nsegments) {
String light = ... | 7 |
private void deMapATablaPersonas(LinkedHashMap<Integer, Persona> personas) {
DefaultTableModel model = ((DefaultTableModel) jTable.getModel());
for (Persona persona : personas.values()) {
model.addRow(new Object[]{persona.getId(), persona.getNombre()});
}
} | 1 |
public static void main(String[] args)
{
int a = 11;
int alphabets[] = { 19, 5, 1, 18, 3, 8, 24, 13, 16, 12 };
int[] hash = new int[alphabets.length];
for (int M = 3;; M++)
{
for (int i = 0; i < alphabets.length; i++)
{
hash[i] = (a * alphabets[i]) % M;
}
Arrays.sort(hash);
boolean duplica... | 6 |
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... | 6 |
public Map<String, Map<String, String>> getObjectsFromTableInMap(
String tableName, String columnFamily, String startRange,
String endRange, String... retrieveColumns) throws IOException {
// Validate the tableName
if (!validateStringIfNullOrEmpty(tableName)) {
throw new IllegalArgumentException(
"In... | 8 |
public void run() {
boolean running = true;
log.debug("SQLMonitor running");
while(running) {
log.debug("Calling Mysql");
ResultSet rs = null;
Connection conn = null;
try {
conn = getConnection();
Statement s = conn.createStatement();
r... | 6 |
public HashMap convertToHashMap(String s) {
HashMap map = new HashMap();
StringTokenizer tokenizerMajor = new StringTokenizer(s,DELIMITER_MAJOR);
while (tokenizerMajor.hasMoreTokens()) {
String tokenMajor = tokenizerMajor.nextToken();
StringTokenizer tokenizerMinor = new StringTokenizer(tokenMajor,DELIMI... | 6 |
public Pawn(boolean isWhite, ImageIcon imgIcon) {
super(isWhite, imgIcon);
this.setIcon();
} | 0 |
public void delete(int id) {
try {
PreparedStatement ps = MySQL_Connection.getConection()
.prepareStatement("DELETE FROM producto WHERE id = "
+ id);
ps.executeUpdate();
} catch (SQLException ex) {
System.out.println("p... | 1 |
public synchronized DatasetObject getObject(int id) throws Exception{
if(offsetFile==null || databaseFile==null)
openFiles(indexDirectory);
//With persistent offsets
long position=id*8;
long l=offsetFile.length();
if(position>=offsetFile.length())
throw new Exc... | 4 |
public static synchronized void pushDirectoryForUpload(File directory, boolean bypassFOD) {
if (directory != null && directory.isDirectory() && directory.listFiles() != null) {
for (File child : directory.listFiles()) {
if (child.isFile())
pushFileForUpload(child,... | 6 |
@Test
public void oneIngredientTest2() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("tell me the first ingredient");
userInput.add("hamburger");
userInput.add("tell me the first ingredient");
userInput.add("tell me the next ingredient");
... | 4 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... | 3 |
public static ArrayList<ArrayList<Integer>> sum4num(int[] num,int target){
ArrayList<ArrayList<Integer>> lists = new ArrayList<ArrayList<Integer>>();
HashMap<ArrayList<Integer>,Integer> hs = new HashMap<ArrayList<Integer>,Integer>();
if (num.length<4) return lists;
Arrays.sort(num);
for (int j = 0;j<num.leng... | 8 |
public Individual orderCross(Individual a, Individual b) {
int numChromosomes = a.genotype.size();
if (verbose) System.out.println(numChromosomes);
List<Object> offspringGenotype = new ArrayList<Object>(Collections.nCopies(numChromosomes, -1));
// Generate random cut interval
int startCut = rand.next... | 9 |
public static void main(String [] args) {
if(args.length < 1) {
showUsage();
}
Properties configurationProperties = new Properties();
try {
configurationProperties.load(new FileReader(args[0]));
node = new AutoMateNode(configurationProperties);
node.start();
} catch (FileNotFoundException e) {
... | 7 |
public Builder mergeChatList(protocols.ChatProtocol.ChatList value) {
if (chatListBuilder_ == null) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
chatList_ != protocols.ChatProtocol.ChatList.getDefaultInstance()) {
chatList_ =
protocols.ChatProtocol.ChatLis... | 3 |
public static void main(String[] args) {
PrintStream outAlias = System.out;
_5_Turtle tommy = new _5_Turtle("Tommy", new Formatter(System.out));
_5_Turtle terry = new _5_Turtle("Terry", new Formatter(outAlias));
tommy.move(0, 0);
terry.move(4, 8);
tommy.move(3, 4);
terry.move(2, 5);
tommy.move(3, 3);
... | 0 |
private byte[] encodePapPassword(final byte[] userPass, byte[] sharedSecret) {
// the password must be a multiple of 16 bytes and less than or equal
// to 128 bytes. If it isn't a multiple of 16 bytes fill it out with zeroes
// to make it a multiple of 16 bytes. If it is greater than 128 bytes
// tr... | 7 |
public void setGameState(int state) {
if (state >= STATE_RUNNING && state <= STATE_STOPPED) // within valid state range
this.gameState = state;
} | 2 |
public void rotateTo(int px, int py, int handle) {
double w2 = getLogicalScreenWidth() * 0.5;
double h2 = getLogicalScreenHeight() * 0.5;
double rx = x + w2;
double ry = y + h2;
double distance = Math.hypot(rx - px, ry - py);
double theta = (px - rx) / distance;
theta = py > ry ? Math.acos(theta) - Math.P... | 7 |
public byte[] getSpecified() {
return specified;
} | 0 |
protected void killWaterskins(MOB mob)
{
if(mob==null)
return;
if(mob.location()==null)
return;
int num=10;
int i=0;
while((num>0)&&(i<mob.location().numItems()))
{
final Item I=mob.location().getItem(i);
if((I instanceof Drink)&&(((Drink)I).containsDrink()))
{
if(I instanceof RawMateria... | 8 |
public void loadShaderOld(Shader shader) {
boolean success=true;
//create program object
int program = ARBShaderObjects.glCreateProgramObjectARB();
int vertShader = 0;
int fragShader = 0;
//vertShader will be non zero if succefully created
vertShader=ARBShaderObjects.glCrea... | 6 |
@Override
public Iterator<PegsMove> getMoves()
{
List<PegsMove> moves = new ArrayList<PegsMove>();
for (PegsPoint p : type.places)
{
// If this is a peg...
if (board[p.y][p.x] == PEG)
{
// Check all directions for a peg then a hole to jump into.
for (int i = 0; i < type.shape; i++)
{
i... | 5 |
public void render() {
switch (getState()) {
case GAME:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1, 1, 1, 1);
realm.render();
player.render();
effectsHandler.render();
interfacehandler.render();
break;
case MAIN_MENU:
break;
case OPTIONS:
break;
case DEAD:
glB... | 5 |
private void prepareNext() throws IOException {
long child_recid = 0;
// find next bucket/directory to enumerate
do {
_child++;
if (_child >= MAX_CHILDREN) {
if (_dirStack.isEmpty()) {
// no more directory ... | 6 |
@SuppressWarnings("static-access")
public void loadConfigForOptionsforWidthHeight(String fileName, String ext)
{
try{
InputStream read = new FileInputStream("./res/config/"+fileName+ext);
if(ext == ".xml")
{
properties.loadFromXML(read);
} els... | 3 |
@Override
public byte[] getHTTPMessageBody() {
try {
return Files.readAllBytes(Paths.get(serverViewsDirectory + "/index.html"));
} catch (IOException e) {
e.printStackTrace();
}
return "File Could Not Be Read".getBytes();
} | 1 |
public void print (String msg) {
JEditorPane transcript = new JEditorPane("text/html", "");
transcript.setText(msg);
try {
boolean complete = transcript.print();
if (complete)
{
JOptionPane.showMessageDialog(null,"Done Printing!","Information",JOptionPane.INFORMATION_MESSAGE);
}
else
{
... | 2 |
public Server(String host,int port){
this.host = host;
this.port = port;
client = new Client(host, port, protocol, new TcpSessionFactory());
client.getSession().addListener(this);
} | 0 |
@WebMethod(operationName = "ReadPage")
public ArrayList<Page> ReadPage(@WebParam(name = "page_id") String page_id) {
Page page = new Page();
ArrayList<Page> pages = new ArrayList<Page>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!page_id.equal... | 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.