text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String[] args) {
final String host;
final int port;
if(args.length == 2) {
host = args[0];
try {
port = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
Syst... | 3 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((!auto)&&(!mob.isInCombat()))
{
mob.tell(L("You must be in combat first!"));
return false;
}
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(M... | 9 |
public void update() {
time++; // every second time is incremented by 60 (because update is 60 times per second)
// if (time % 60 == 0) { // event that happens once per second
if (time % (random.nextInt(50) + 30) == 0) { // event that happens once between 30 to 80 seconds
// xa *= -1; // reverse dir... | 9 |
@EventHandler
public void IronGolemHarm(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.getIronGolemConfig().getDouble("IronGolem.H... | 6 |
void menuOpenURL() {
animate = false; // stop any animation in progress
// Get the user to choose an image URL.
TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
textPrompter.setText(bundle.getString("OpenURLDialog"));
textPrompter.setMessage(bundle.getString("En... | 7 |
public static void main(String[] args) {
String filename = null;
Player p = null;
//Build the map of the game
map m = new map();
if (args.length==0) {
System.out.print("Please enter a valid game file name!\n");
System.exit(1);
}
else{
filename = args[0];
}
try {
... | 3 |
void setup(Object associations[], String description) {
Batch appB = new Batch(), reqB = new Batch(), conB = new Batch() ;
Batch toAdd = null ;
for (Object o : associations) {
if (o == APPEALS ) toAdd = appB ;
else if (o == REQUIRES ) toAdd = reqB ;
else if (o == CONFLICTS) toAdd = c... | 4 |
public static int lengthOfLongestSubstring(String s) {
if(s == null || s.length() == 0){
return 0;
}
if(s.length() == 1){
return 1;
}
int max = 0;
int curLen = 0;
byte[] sb = s.getBytes();
int table[] = new int[129];
for(i... | 9 |
private void jConnectBtnActionPerformed(java.awt.event.ActionEvent evt) {
if (!connected) {
try {
joy1Selection.setEnabled(false);
joy2Selection.setEnabled(false);
InetAddress.getByName(jIPField.getText());
robotInstance.getPacketTransmitter().setRemoteTarget(jIPField.getText(), 2... | 2 |
private int drawSeg(final Graphics2D seg,
final double length, final double rot, final int oldNo) {
int no = oldNo;
double pos = 0.0;
final double end = Math.max(length - segLen * 0.5, 0.0);
while(pos <= end) {
final Graphics2D s = (Graphics2D) seg.create();
if(isFirst &&... | 8 |
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 |
public boolean isPrime(long number){
int counter = 0;
long factor = 0;
boolean isPrime = true;
if (number==2){
return true;
} else if (number%2 == 0){
return false;
}
while(isPrime && factor <= number/2){
if (counter < primeCounter){
counter = counter + 1;
factor = Prime[counter];
... | 6 |
public void playNotesOnChannel(int index,
int [] notes,
int [] durations,
int [] intensities)
{
// set the channel based on the index
channel = channels[index];
// loop through the array of notes
... | 3 |
public String[] Myself(boolean place)
{
try{
driver.get(baseUrl + "/content/lto/2013.html");
//global landing page
driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[3]/ul/li[3]/a")).click();
//Hong Kong landing page - Order Now button
driver.findElement(By.xpath("/h... | 7 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int t = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
int[] ab = readInts(line);
if (ab[0] ... | 5 |
public static void main(String[] args) throws Exception {
int iterations = 1000000;
int mode = GREGORIAN_MODE;
long seed = 1345435247779935L;
if (args.length > 0) {
iterations = Integer.parseInt(args[0]);
if (args.length > 1) {
if (args[1].startsW... | 5 |
public static void main(String args[]) {
Logger log = Logger.getLogger("MAIN");
Properties pt = new Properties();
pt.setProperty("connection.host", "127.0.0.1");
pt.setProperty("connection.port", "21");
pt.setProperty("user.login", "kurt");
pt.setProperty("user.password"... | 5 |
@Override
public boolean equals(Object other) {
if (other == this) { return true; }
else if (!(other instanceof WildcardTypeDesc)) { return false; }
WildcardTypeDesc type = (WildcardTypeDesc) other;
return ((this.lowerBounds == null && type.lowerBounds == null) ||
(t... | 9 |
@Override
public <N, T> T getFirstValue(TKey<N, T> key, Enum<?>... qualifiers) {
T result = null;
List<QualifiedValue<?>> values = fields.get(key);
if (values != null && values.size() > 0) {
for (QualifiedValue<?> value : values) {
if (checkQualifier(value, qualif... | 7 |
public boolean GetSearchIfSequenceUsingTheBus(int sequence)
{
for(int seq:this.sequence)
{
if (seq == sequence)
return true;
}
return false;
} | 2 |
private static int TakeInput(){
int num = -1;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true)
{
try {
num = Integer.parseInt(br.readLine());
if (num>=0 && num < B... | 4 |
public void checkChars(String msg, String str, MutableString mut)
{
if (str.length() != mut.length())
{
fail(msg + " (strings have different lengths): " +
str.length() + " vs. " + mut.length());
} // if the lengths differ
for (int i = 0; i < str.length(); i++)
{
... | 3 |
private boolean jj_2_29(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_29(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(28, xla); }
} | 1 |
public Binomial union(Binomial k1, Binomial k2) {
Binomial k = new Binomial();
//valitaan juuri mergen avulla
k.root = merge(k1, k2);
if (k.root == null) {
return k;
}
Binomialnode previous = null;
Binomialnode current = k.root;
Binomialnode ne... | 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 |
private boolean allowedNetwork() throws SocketException {
boolean allowed = false;
Enumeration e = NetworkInterface.getNetworkInterfaces();
while (e.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) e.nextElement();
Enumeration e2 = ni.getInetAddresses();
... | 5 |
public void deleteRefereeClassFromList(RefereeClass r)
{
// set relevant position in refereeClassArray to null
refereeClassArray[getPositionInRefereeClassArray(r.getRefereeName())] = null;
// decrement number of elements in the array
elementsInArray--;
// create a new array of non-null values and
// ... | 2 |
private final String formatAmount(final Object amountObject) {
final DecimalFormat df =
new DecimalFormat( "#,###,###,###,###,###,###,###,##0.00" );
if (amountObject instanceof String) {
if (!((String) amountObject).matches(NUMBERS)) {
return "0.00";
... | 3 |
private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) {
if(transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for(int i=1,n=curLine.length ; i<n ; i+=3) {
byte r = curLine[i];
by... | 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.ver... | 6 |
synchronized void backward(float[] in, float[] out) {
if (_x.length < n / 2) {
_x = new float[n / 2];
}
if (_w.length < n / 2) {
_w = new float[n / 2];
}
float[] x = _x;
float[] w = _w;
int n2 = n >>> 1;
int n4 = n >>> 2;
in... | 5 |
public void printWriter(String tomorrowDate) //laver en liste over check-ins
{
Connection conn = null;
Statement stmt = null;
try{
//Registrer JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver");
//Åben forbindelsen
conn = DriverManag... | 9 |
@Override
public void init(){
for (GameObject go:Engine.getScreen().getRoot().getChildren()){
if (go.hasComponent("level")){
level = (Level)go.getComponent("level");
}
}
sy = parent.getScale().getY();
sx = parent.getScale().getX();
} | 2 |
public void runRecv(){
DataInputStream inputStream;
try {
inputStream = new DataInputStream(socket.getInputStream());
} catch (IOException e) {
LOG.severe("Could not get inputstream! " + e.getMessage());
return;
}
while(!Thread.interrupted()){
... | 5 |
public List<Integer> getIntellingentMovementHistory() {
return intellingentMovementHistory;
} | 0 |
public void tick() {
inputTick(input);
if (pressedTimer > 0) pressedTimer--;
int xm = 0;
if (input.up) xm--;
else if (input.down) xm++;
if (xm != 0) moveSelection(xm);
if (input.enter && pressedTimer <= 0) {
pressedTimer = 30;
int state = getCurStateID();
press();
if (getCurStateID() != state)... | 8 |
public static javax.net.ServerSocketFactory getServerSocketFactory()
throws IOException {
if (isSslEnabled()) {
if (sslFactory == null) {
try {
sslFactory = BogusSslContextFactory.getInstance(true)
.getServerSocketFactory();... | 4 |
private int handleD(String value,
DoubleMetaphoneResult result,
int index) {
if (contains(value, index, 2, "DG")) {
//-- "Edge" --//
if (contains(value, index + 2, 1, "I", "E", "Y")) {
result.append('J');
i... | 3 |
public int patientsLengthIteratively() {
int patientsCounter = 1;
while (nextPatient != null) {
patientsCounter++;
nextPatient = nextPatient.nextPatient;
}
return patientsCounter;
} | 1 |
public void processCollision(int weapon, int enemy, char type){
switch (type) {
case 'c': { // cannon hits enemy ship
updateScore('c');
cannons.remove(weapon);
sinkingShips.add(initials.get(enemy));
initials.remove(enemy);
... | 4 |
public void removePath(Byte A, Byte B) {
if(networkTreeMap.containsKey(A)) {
networkTreeMap.get(A).remove(B);
}
if(networkTreeMap.containsKey(B)) {
networkTreeMap.get(B).remove(A);
}
if(autoUpdate) {
update();
}
} | 3 |
private static <T extends Comparable<? super T>> void insertionSort(
T[] a, int left, int right) {
for (int p = left + 1; p <= right; p++) {
T tmp = a[p];
int j;
for (j = p; j > left && tmp.compareTo(a[j - 1]) < 0; j--)
a[j] = a[j - 1];
a[j] = tmp;
}
} | 4 |
public void joinRoom(String message, String currentname, Socket socket){
room = message.substring(6);
if(roomlist.containsKey(room)){
roomnum = Integer.parseInt((roomlist.get(room)).toString());
//Checks if a user is in the room already
if((rooms.get(roomnum-1)).containsKey(currentname)){
try{
... | 5 |
public int[][] getDijkstraRoutedArray() {
int[][] daRgb = rgb;
int i = this.destI_pos;
int j = this.destJ_pos;
double cost = 0;
if (graph[i][j].getPath() != null) {
cost = graph[i][j].getDistanceFromStartPoint();
while (graph[i][j].getPath() != null) {
... | 5 |
@Override
public boolean blocked(PathFindingContext context, int x, int y) {
if(x < 0 || y < 0 || x >= width || y >= height){
return true;
}
return tiles[x][y].isSolid();
} | 4 |
public static LabFactory getInstance()
{
INSTANCE_LOCK.readLock().lock();
if (INSTANCE == null)
{
INSTANCE_LOCK.readLock().unlock();
INSTANCE_LOCK.writeLock().lock();
try
{
if (INSTANCE == null)
{
INSTANCE = createInstance();
}
}
finally
{
INSTANCE_LOCK.writeLock().unlock();
}
... | 2 |
@Before
public void setUp() {
calendarUsers = new CalendarUser[3];
events = new Event[3];
//기존 등록된 유저 삭제
this.calendarUserDao.deleteAll();
//기존 등록된 이벤트 삭제
this.eventDao.deleteAll();
//디폴트 유저 등록
CalendarUser setupCreateUser1 = new CalendarUser("user1@example.com","user1","User1");
CalendarUser... | 3 |
public void testReadMultithreadedWrite() throws IOException, InterruptedException {
final int numThreads = 16;
final int insertsPerThread = 256;
final int numEntries = numThreads*insertsPerThread;
final ByteChunk[] keys = new ByteChunk[numEntries];
final ByteChunk[] values = new ByteChunk[numEntries];
... | 6 |
public ClientListUI(ClientListSelectorReceiver callback)
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
this.callback = callback;
setLayout(new GridLayout(0,1));
clientList.setLayout(new GridLayout(0,1));
clientList.setVisible(true);
add(clientList);
JButton selectButton = new JButton("Select");
sele... | 0 |
public void testPropertySetSecond() {
LocalTime test = new LocalTime(10, 20, 30, 40);
LocalTime copy = test.secondOfMinute().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 20, 12, 40);
try {
test.secondOfMinute().setCopy(60);
fail();
... | 2 |
private int solveStack(int nextRank) throws InvalidEquationException {
//Create variables for the current section of equation
NumericalExpression e2 = null;
NumericalExpression e1 = null;
OperatorExpression op = null;
try{
//Pop the first numerical expression off stack (rhs)
e2 = (NumericalExpression)e... | 5 |
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
// If they change the text area's font, we need to update cell
// heights to match the font's height.
if ("font".equals(name) ||
RSyntaxTextArea.SYNTAX_SCHEME_PROPERTY.equals(name)) {
for (int i=0; i<getCompone... | 6 |
protected void selectPoint(double[] point) {
if (!isSet || (this.dim != 2 && this.dim != 3)) {
logger.info("Point was picked with no useable Fundamental Region.");
return;
}
logger.info("Selected Point (" + point[0] + "," + point[1] +
(this.dim == 3 ? "," + point[2] : "") + ")");
... | 7 |
public final void attrSplit(int attr, Instances inst) throws Exception {
int i;
int len;
int part;
int low = 0;
int high = inst.numInstances() - 1;
PairedStats full = new PairedStats(0.01);
PairedStats leftSubset = new PairedStats(0.01);
PairedStats rightSubset = new PairedStats(0.0... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CurrencyInfo that = (CurrencyInfo) o;
if (code != null ? !code.equals(that.code) : that.code != null) return false;
if (rate != null ? !rate.eq... | 7 |
public void inverteOrientacao(){
if(orientacaoVetorEmLinha == 'c')
orientacaoVetorEmLinha = 'b';
else if(orientacaoVetorEmLinha == 'b')
orientacaoVetorEmLinha = 'c';
else if(orientacaoVetorEmLinha == 'd')
orientacaoVetorEmLinha = 'e';
else if(orientacaoVetorEmLinha == 'e')
orientacaoVetorEmLinha = '... | 4 |
private int[][] down() {//all numbers will down and combine when possible
int[][] egrid = clone2DArray(grid);
for (int xIndex = 0; xIndex < 4; xIndex++) {
for (int yIndex = 0; yIndex < 3; yIndex++) {
if (egrid[yIndex + 1][xIndex] == 0) {
for (int a = yInde... | 9 |
public Class<? extends Number> getReturnType(ObjectStack stack) throws NoSuchMethodException, SecurityException
{
Class<?> clazz = null;
if (methodName != null)
{
Method method = stack.getActualRepresentation().getRepresentedClass().getMethod(methodName);
String colname = NameGenerator.getColumnName(method... | 3 |
public String basicInfo()
{
String str = getName();
str += "\nMass (in kilograms): " + getMass() + " of maximum " + getMaxMass();
str += "\nVolume used (in litres): " + getVolume() + " of maximum " + getMaxVolume();
str += "\nContents:";
if(getContents() == null || get... | 3 |
private void live() throws Exception {
long start = System.currentTimeMillis();
FileWriter wr = new FileWriter(OUTPUT_FOLDER + "/model" + System.currentTimeMillis() + ".csv");
StringBuilder b = new StringBuilder();
b.append("#,");
// Print header
for (ConnectionDistributor d : distrib... | 3 |
private synchronized JSONArray getLocations(String userKey) {
JSONArray locations = null;
if (userKey == null || userKey.isEmpty())
return locations;
try {
String url = this.urlManager.getUserInfo(Constants.APP_KEY, userKey);
JSONObject jo = getJson(Methods.... | 5 |
* if the queue is empty
*/
public E dequeue() throws EmptyQueueException {
if (this.isEmpty())
throw new EmptyQueueException();
else {
E temp = array.get(front);
if (front < array.size() - 1)
front++;
else {
front = 0;
}
if (front == rear) {
front = -1;
rear = 0;
... | 3 |
public void splitNode(BallNode node, int numNodesCreated) throws Exception {
correctlyInitialized();
double maxDist = Double.NEGATIVE_INFINITY, dist = 0.0;
Instance furthest1=null, furthest2=null, pivot=node.getPivot(), temp;
double distList[] = new double[node.m_NumInstances];
for(int i=node.m... | 8 |
@Override
public boolean equals(Object note) {
if (note != null) {
if (this == note) {
return true;
} else if (note instanceof HindustaniNote){
if (this.octave == ((HindustaniNote)note).getOctave()
&& this.swar == ((HindustaniNote)note).getSwar()) {
return true;
}
}
}
return fals... | 5 |
public void paint(Graphics g){
this.setDoubleBuffered(true);
Insets in = getInsets();
g.translate(in.left, in.top);
//int[][] gameboard = logic.getGameBoard();
int cols = gameBoard.length;
int rows = gameBoard[0].length;
for (int c = 0; c < cols; c++){
for (int r = 0; r < rows... | 8 |
public String renameFolder() {
if (selectedFolder == null) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error",
"You have not selected a folder for renaming"));
return null;
}
FolderDTO folder = (FolderDTO) selectedFolder.getData();
if (... | 3 |
private void stopUpdate() {
if(periodicAddonUpdate != null && !stopwatchRunning && timers.size() == 0)
stopPeriodicUpdate();
} | 3 |
public static long prochainPremier(long num) {
if (num <= 1) throw new IllegalArgumentException();
if (num != 2 && num % 2 == 0) {
num++;
}
while (!Num1.estPremier(num)) {
num += 2;
}
return num;
} | 4 |
public static void main(String[] args) {
// Create an inventory of Widgets
List<Widget> widgetList = new LinkedList<Widget>();
widgetList.add( new Widget( "Widget 1", "The first kind of widget") );
widgetList.add( new Widget( "Widget 2", "The second kind of widget") );
widgetList.add( new Widge... | 6 |
public Square[][] kinging(Square[][] theBoard)
{
for (int x = 0; x < 8; x++)// kinging.
{
if (theBoard[x][7].getPiece() == '@')
{
theBoard[x][7].king();
} else if (theBoard[x][0].getPiece() == '$')
{
theBoard[x][0].king(... | 3 |
public Action poolCurrentAction() {
if(actions.isEmpty()) {
return null;
}
Action next = actions.poll();
if(loop) {
next.reset();
actions.add(next);
}
return next;
} | 2 |
public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (catchBlock == oldBlock)
catchBlock = newBlock;
else
return false;
return true;
} | 1 |
public void run() {
while(model.GRAVITY) {
Point location = model.getRobotLocation();
boolean inTheAir = location.y < 175;
boolean aboveAHole = model.getHoles().contains(new Rectangle(location.x,
location.y + 25, 25, 25));
if(inTheAir || aboveAHole) {
if(model.canRobotMove(Direction.DOWN)) {
... | 5 |
public int verschilInDagen(DatumGregCal d) {
int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
DatumGregCal startDate;
DatumGregCal endDate;
if (this.kleinerDan(d)) {
startDate = d;
endDate = this;
}else {
startDate = this;
endDate = d;
}
long endInstant = endDate.getCalender().getTim... | 4 |
@Before
public void setUp() throws Exception {
System.out.println("start");
getDriver().get("http://www.google.com");
} | 0 |
public String getDescription() {
String desc = getLabel();
if (desc.length() == 0)
return Universe.curProfile.getEmptyString(); // I am a badass.
return getLabel();
} | 1 |
public static InputMode abilityInputMode(AbilityType type) {
if (type == null) {
return null;
}
switch (type) {
case abil_aim_fire:
return AIM;
case abil_tar_heal:
return TARGET;
case abil_dir_cleave:
... | 5 |
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int n = s.length();
int[] p = new int[n+1];
p[0] = -1;
int k = -1;
for(int i=1; i<=n; i++) {
w... | 8 |
@Override
public void update(){
if(getLives() <= 0){
dead = true;
this.fire.dead = true;
}
if(newBorn){
--counter;
}
if(counter == 0){
newBorn = false;
counter = Constants.INVINSIBLE;
}
action = control.action(game);
if(action.thrust == 1){
thrusting = true;
showFire();
... | 6 |
protected void showSelectedHotel(SessionRequestContent request) {
String selected = request.getParameter(JSP_SELECT_ID);
Hotel currHotel = null;
if (selected != null) {
Integer idHotel = Integer.decode(selected);
if (idHotel != null) {
List<Hotel> list = (... | 5 |
public boolean validarIngresoFecha(String fecha) {
if (fecha == null)
return false;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
if (fecha.trim().length() != dateFormat.toPattern().length())
return false;
dateFormat.setLenient(false);
try {
dateF... | 3 |
public void compFinalResult() {
do {
iStage++;
compAllocation();
if (compDistribution()) {
/* deadline can not be satisfied */
if (!bDeadline) {
System.out.println("CostMinmin: THE DEADLINE CAN NOT BE SATISFIED!");
return;
} else {
System.out.println("\nNEW ROUND WITHOUT CHECKING:... | 7 |
public void renderRaisedSprite(int xp, int yp, Sprite s) {
int w = s.W;
int h = s.H;
xp -= xOffs;
yp -= yOffs;
int[] iso = twoDToIso(xp, yp);
xp = iso[0];
yp = iso[1];
for (int y = 0; y < h; y++) {
int ya = y + yp - h; // absolute position
... | 8 |
private static List<ImageFileProvider> unzip (final File droppedFile) {
try {
final List<ImageFileProvider> providers = new ArrayList<ImageFileProvider> ();
Enumeration<? extends ZipEntry> entries = new ZipFile (droppedFile).entries ();
for (int i = 1; entries.ha... | 8 |
private void invariant() throws InvalidFrageException
{
InvalidFrageException e = new InvalidFrageException(this);
if (getFragestellung() == null || getFragestellung().isEmpty())
e.addInvalidField("fragestellung");
if (getModul() == null)
e.addInvalidField("modul");
if (getSchwierigkeitsgrad() == null... | 6 |
@Override
public Event next() {
String input = null;
try {
input = br.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(input == null || input.equals("")){
return null;
}
else{
return new UserHomeState(as, input);
}
} | 3 |
Levels()
{
Properties props = System.getProperties();
for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements(); )
{
String propName = (String) e.nextElement();
if (propName.startsWith(LEVEL_PREFIX))
{
String levelKey = (propNa... | 7 |
public void generateMipMaps(ByteBuffer data, int width, int height, boolean test) {
ByteBuffer mipData = data;
for (int level = test ? 0 : 1; level <= 4; level++) {
int parWidth = width >> level - 1;
int mipWidth = width >> level;
int mipHeight = height >> level;
... | 6 |
public static void main(String[] args) {
System.out.println(1.0 + 2.0); // 3.0
System.out.println(2.0 - 3.0); // -1.0
System.out.println(3.0 * 4.0); // 12.0
System.out.println(16.0 / 5.0); // 3.2
System.out.println(16.0 % 5.0); // 1.0
} | 0 |
@Override
protected boolean wrappedHandle(Request r, Template t) {
t.putVariable("title", "Profile");
File[] possibles = Profile.getInstance().getPossibleProfiles();
if (r.getGetVars().isSet("i")) {
// select the profile
int i = -1;
try {
i = Integer.parseInt( r.getGetVars().getValue("i") );
... | 8 |
public int _offsetToX(int line, int offset)
{
TokenMarker tokenMarker = getTokenMarker();
/* Use painter's cached info for speed */
FontMetrics fm = painter.getFontMetrics();
getLineText(line,lineSegment);
int segmentOffset = lineSegment.offset;
int x = horizontalOffset;
/* If syntax coloring is disa... | 7 |
private void determineRemainingTransition() {
myTransitionsMap=new HashMap <Integer, ArrayList <String>>();
myNeededTransitionMap=new HashMap <Integer, ArrayList <String>>();
myReadSets=new TreeSet <String>();
myStateMap=new HashMap <Integer, State>();
State[] s=automaton.getStates();
for (int i=0; i<s.leng... | 5 |
public static void main (String args[]) {
Neo4jAdapter adapter = new Neo4jAdapter();
adapter.connect();
adapter.insert();
adapter.queryParams();
if (args.length > 0) {
String s = args[0];
switch (Integer.valueOf(s)) {
case 1:
adapter.doQ... | 5 |
private void procesarLogIn(String id, String tipo, String message) {
final String nick = message.substring(0, message.lastIndexOf("|"));
final String uuid = message.substring(message.lastIndexOf("|") + 1);
switch (tipo) {
case "c":
String idServer = getServerIdByNick(... | 5 |
public List<Recording> alignWithDB(List<Recording> recordings){
Recording returnrec = null;
for(Iterator<Recording> it = recordings.iterator(); it.hasNext(); ){
Recording recording = it.next();
returnrec = this.find(recording.getId(), recording.getType());
if(!returnrec.isComplete()){
if(returnrec.g... | 4 |
public void addRet(int var) {
if (var < 0x100) {
addOpcode(RET);
add(var);
}
else {
addOpcode(WIDE);
addOpcode(RET);
addIndex(var);
}
} | 1 |
public ArrayList<Integer> conversionASCII(String mot)
{
char[] tabchar = mot.toCharArray();
ArrayList<Integer> chaine = new ArrayList<Integer>();
for( int i=0 ; i < mot.length() ; i++)
{
chaine.add((int)tabchar[i]);
}
return chaine;
} | 1 |
public static void main(String[] args){
//buy some item
buyItemTester(Constants.AKAVIRI_SWORD);
buyItemTester(Constants.ANGEL_BODY_ARMOR);
buyItemTester(Constants.ANGEL_HEAD_ARMOR);
// show storeage
ItemStorageInventory.create().showStorage();
// get an item from the list
//getItemTester(Consta... | 3 |
static private String readDBFromSettingsFile() {
BufferedReader r = null;
try {
r = new BufferedReader(new FileReader("MICEsettings.ini"));
} catch (FileNotFoundException e) {
e.getMessage();
}
String res = null;
if (r != null) {
try {... | 4 |
public String getDefaultName() {
switch (((IntegerType) getHint()).possTypes) {
case IT_Z:
return "bool";
case IT_C:
return "c";
case IT_B:
case IT_S:
case IT_I:
return "i";
default:
throw new jode.AssertError(
"Local can't be of constant type!");
}
} | 5 |
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.