text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main( String [ ] args )
{
BinarySearchTree t = new BinarySearchTree( );
final int NUMS = 4000;
final int GAP = 37;
System.out.println( "Checking... (no more output means success)" );
for( int i = GAP; i != 0; i = ( i + GAP ) % NUMS )
t.inse... | 9 |
private void startGame() {
if (animator == null || !isRunning) {
animator = new Thread(this);
animator.start();
}
} | 2 |
public Stats computeBlockStats() throws IOException {
// TODO: add total auto-prefix term count
Stats stats = new Stats(fr.parent.segment, fr.fieldInfo.name);
if (fr.index != null) {
stats.indexNumBytes = fr.index.ramBytesUsed();
}
currentFrame = staticFrame;
FST.Arc<BytesRef> a... | 9 |
public static void main(String[] args) {
List<Pattern> patternList = new LinkedList<Pattern>();
try{
if (args[0].startsWith("http://"))
{patternList = PatternLoader.loadFromURL(args[0]);}
else
{patternList = PatternLoader.loadFromDisk(args[0]);}
try{
int index = Integer.parseInt(args[1]);
if... | 8 |
@Override
public long spawnBoss(String bossData) {
super.spawnBoss(bossData);
GameActor a = Application.get().getLogic().createActor(bossData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
pc.setLocation(x - 200, y + 200);
pc.setAngleRad(MathUti... | 1 |
private BufferedImage shiftColor(BufferedImage img, int rShift, int gShift, int bShift)
{
int width = img.getWidth();
int height = img.getHeight();
for(int i = 0; i < height; i++)
for(int j = 0; j < width; j++)
{
int c = img.getRGB(j, i);
int alpha = c >> 24 & 0xff;
int red = (c >> 16 & 0xff) -... | 5 |
public static <A> Ord<Array<A>> arrayOrd(final Ord<A> oa) {
return ord(a1 -> a2 -> {
int i = 0;
//noinspection ForLoopWithMissingComponent
for (; i < a1.length() && i < a2.length(); i++) {
final Ordering c = oa.compare(a1.get(i), a2.get(i));
if (c == Ordering.GT || c ... | 7 |
@Override
public Card chooseCard(Player player, Card[] cards, GameState state) {
//If it's the start of a new week, we need a fresh cache
if(state.getDay() == 0)
{
cache = new HashMap<GameState, Integer>();
}
//If there's only one choice, we have no choice but to do it
if(cards.length == 1)
{
... | 5 |
public final T getNoodi(int x, int y) {
if (x >= 0 && x <= this.leveys && y >= 0 && y <= this.korkeus){
return noodit[x][y];
} else {
return null;
}
} | 4 |
boolean checkIfInWater(LivingEntity entity)
{
boolean entityIsInWater = false;
if(null != entity)
{
Material mat = entity.getLocation().getBlock().getType();
if(mat == Material.STATIONARY_WATER || mat == Material.WATER)
{
entityIsInWater = true;
}
... | 3 |
public void toFile(String filename) throws FileNotFoundException, UnsupportedEncodingException {
PrintWriter writer = new PrintWriter(filename, "UTF-8");
writer.println(h + " " + w);
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
writer.print(cells[x][y] ? "#" : ".");
writer.println();
}
... | 3 |
private static double computePitchValue(int frameLength, float sampleRate,
Matrix rowMatrix) {
/**
* computes the pitch of one frame of a speech signal. no logger was
* placed here since this is called many times for one audio file
*/
try {
/** find the clipping level */
/** get the location of A... | 9 |
private byte ok() {
String name = nameField.getText();
if (!name.matches("\\w{4,}")) {
return NAME_ERROR;
}
if (task == null) {
if (job.containsName(name))
return NAME_EXISTS;
Loadable l = new AbstractLoadable(intervalField.getValue()) {
public void execute() {
job.runScript(getScript());... | 7 |
@Override
public Map<Integer, Double> calculate(File experimentDir) throws Exception{
System.out.println("Generating average uptime for "+experimentDir);
Map<Integer, List<Double>> averageUptime = new HashMap<Integer, List<Double>>();
for (File experiment: experimentDir.listFiles()) {
... | 6 |
public void setType(Type type){
long now, then, delta;
then = System.nanoTime();
this.type = type;
try{
this.texture = TextureLoader.getTexture("PNG", new FileInputStream(new File(type.location)));
}catch(FileNotFoundException e){
e.printStackTrace();
if(doLog){
log.writeToLog("CRITICAL ERROR:... | 5 |
public static ObjectOutputStream getOut() {
if(out==null){
try {
out = new ObjectOutputStream(socket.getOutputStream());
} catch (IOException e) {
throw new ConexionException("Error al crear el object out: "
+ e.getMessage(), e);
}
}
return out;
} | 2 |
public void setjTextFieldPrenom(JTextField jTextFieldPrenom) {
this.jTextFieldPrenom = jTextFieldPrenom;
} | 0 |
protected void editarCrlv(){
int index = gCrlv.getTableGerenciarCrlvs().getSelectionModel().getLeadSelectionIndex();
if(index > -1){
//gCrlv.getCrlv().get(index);
ViewCrlv jifCrlv = new ViewCrlv();
ControllerCrlv conCrlv = new ControllerCrlv(jifCrlv, gCrlv.getCrlv().g... | 1 |
public static void main(String[] args){
Scanner console = new Scanner(System.in);
System.out.println("Give me temperature values!");
String input = console.nextLine();
String[] inputArray = input.split(" ");
double[] values = new double[inputArray.length];
try{
for ( int i = 0; i < valu... | 8 |
public Lcd() {
getStyleClass().add("lcd");
value = new DoublePropertyBase(0) {
@Override protected void invalidated() {
set(clamp(getMinValue(), getMaxValue(), get()));
}
@Override public Object getBean() { return this; }
... | 4 |
public static String getResult(String urlStr){
URL url = null;
HttpURLConnection connection = null;
try {
url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("GET");
connection.setUse... | 3 |
public static Markers readTxt(String fileName, Genome genome, int positionBase) {
if (genome == null) genome = new Genome();
Markers markers = new Markers();
// Parse lines
LineFileIterator lfi = new LineFileIterator(fileName);
int lineNum = 1;
for (String line : lfi) {
Marker interval = new Marker();
... | 2 |
private void startInputMonitor(){
while(noStopRequested){
try{
//this.processRegisteAndOps();// 处理通道监听注册和读取事件注册
int num = 0;
//this.selector.selectedKeys().clear();// 清除所有key
// Wait for an event one of the registered channels
num = this.selector.select(50);
//num = t... | 8 |
@Override
public synchronized void handleIOException(SharingPeer peer,
IOException ioe) { /* Do nothing */ } | 0 |
public static final int getLevel(final String levelName) {
String _levelName = levelName;
if (levelName == null) {
return -1;
} else {
_levelName = levelName.trim();
}
if("DEBUG".equalsIgnoreCase(_levelName)) { return LEVEL_DEBUG;
} else if("INFO".equalsIgnoreCase(_levelName)) { return L... | 9 |
public MainFrame() {
super("Kingdoms");
this.nextTurnButton = new JButton("next turn");
nextTurnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
game.nextTeamTurn();
}
});
GameModel model = null;
GameView game = null;
try {
model = ... | 1 |
private void create() {
int width = 1000;
int depth = 700;
try {
if(width < 0 || depth < 0){
throw new Exception("Ein Ozean mit diesen Groessen kann leider nicht erstellt werden, da min. ein Wert(Breite oder Tiefe) kleiner als 0 ist." + "\n" +
"Bitte geben Sie zulaessige Werte ein." + "Bei ... | 4 |
public boolean add(Object o) {
LocalInfo li = (LocalInfo) o;
LocalInfo contained = findSlot(li.getSlot());
if (contained != null) {
li.combineWith(contained);
return false;
} else {
grow(1);
locals[count++] = li;
return true;
}
} | 1 |
public void multiEq(String block, int mode, int shift) throws IOException {
for (String div_block : block.split("<br />={" + mode + "} ")) {
status[mode - 2 - shift] = div_block.split("=", 2)[0].replaceAll(
" $", "").replaceAll("^.*<br />.*$", "");
if (mode == 4 + shift)
tripleQuot(div_block);
else
... | 2 |
public static void computeStats(String directoryName) {
try {
if(!ghosteryFile.equals("")) {
// TRACKERS
BufferedWriter trackersStatsFile = new BufferedWriter(new FileWriter(new File(directoryName+"/logs/stats_trackers.csv"), false));
Map<String, Integer> sortedTrackersGhosteryStats = sortByValueInDes... | 9 |
public void update(Ship ship ,int delta) {
if (state == States.MISSILE) {
setX(getX() - delta * speed);
anims[States.MISSILE.ordinal()].update(delta);
check_collisions(ship);
} else if (state == States.EXPLOSION) {
if (anims[States.EXPLOSION.ordinal()].is_stopped()) {
state = Sta... | 3 |
public static void main(String[] args) {
// Current scanning point
int[] cifre = new int[numeroCifreDaMoltiplicare];
Arrays.fill(cifre, 1); // should put the real digits, but if result is > 0 then it is fine all 1s
long prod = 1;
// Keep current solution
long maxProd = 0;
int posMax = 0;
int[] cifre... | 7 |
public static void main(String args[]) {
try {
int a = args.length;
System.out.println("a = " + a);
int b = 42 / a;
int c[] = { 1 };
c[42] = 99;
} catch(ArithmeticException e) {
System.out.println("Divide by 0: " + e);
} catch(ArrayIndexOutOfBoundsException e) {
... | 2 |
public void act(){
if(currentDelay==0){
int index=bulletsFired.length-bulletsLeft;
for(int a=0; a<baseBullet.length; a++){
bulletsFired[index]=new Bullet(baseBullet[a]);
bulletsFired[index].addAngle(bulletAngle);
getWorld().addObject(bulletsFired[index], x, y);
bulletsLeft--;
index++;
}
... | 5 |
public static void main(String args[]) {
switch (args.length) {
case 0:
// Run tests normally.
junit.textui.TestRunner.run(suite());
break;
case 2:
// Run registry, test server or client process.
int config = new Integer(args[1]).intVal... | 7 |
public void lifeCycle(int counts) {
for (int i = 1; i <= counts; i++) {
moveAllAnimals();
birthNewVictim(i);
death();
}
} | 1 |
public void createTextureFromBytes(int[] par1ArrayOfInteger, int par2, int par3, int par4)
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, par4);
if (useMipmaps)
{
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
GL11.glTe... | 6 |
public void setTimeInterval(IntDataType value) {
this.timeInterval = value;
} | 0 |
public boolean getBooleanProperty(String prop, boolean defaultValue) {
String value = getProperty(prop);
boolean returnValue = defaultValue;
if (value != null) {
try {
returnValue = Boolean.getBoolean(value);
} catch (NumberFormatException e) {
LOG.error("getBooleanProperty: Property value not a boo... | 2 |
@Column(name = "PRP_MOA_TIPO")
@Id
public BigInteger getPrpMoaTipo() {
return prpMoaTipo;
} | 0 |
@Test
public void randomGenerateTest() {
Board b = new Board(4, 4);
int temp[][] = new int[][]{{2, 2, 0, 4}, {0, 0, 0, 4}, {4, 0, 0, 16}, {0, 4, 128, 0}};
int original[][] = new int[temp.length][];
for (int i = 0; i < original.length; i++) {
original[i] = new int[temp[i].... | 6 |
public boolean hasEmpty(Object... values) {
int length = ArrayUtil.getLength(values, true);
do {
if (isEmpty(values[--length])) {
return true;
}
} while (length > 0);
return false;
} | 2 |
@Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
for(int i = 1; i <= filteredImage.getHeight(); i++) {
for(i... | 3 |
public MonitorAction produceStatsListForTime(String time) throws Exception {
init();
Date date = parseTime(time);
Stat[] latest = db.getLatestStats();
for (int i = 0; i < latest.length; i++) {
latest[i] = db.getStatsForTime(latest[i].getName(), date.getTime());
}
... | 1 |
private void initPanel(){
JPanel p = new JPanel();
p.setLayout(null);
for (int i=0;i<9;i++){
createLabel(p,i);
createTextField(p,i);
}
// Add confirm button
JButton confirmButton = new JButton("Confirm");
confirmButton.setBounds(WIDTH/4, 9*HEIGHT/11, WIDTH/2, HEIGHT/13);
confirmButton.addActionLi... | 5 |
public ShutdownHook()
{
super(new Runnable()
{
@Override
public void run()
{
final File natives = new File(Vars.NATIVES_DIR);
if (Files.exists(natives.toPath()))
{
System.out.println("Deleting Native: " + natives.getPath());
FileHelper.deleteDirectory(natives);
}
Loader.addE... | 4 |
private static int runInputPastAddressHiOrLoNoLimit(int move, int joypadInputAdd, int addressToPass) {
while (true) {
State initial = curGb.newState();
runToAddressNoLimit(0, 0, addressToPass);
int stepsToAddress = curGb.stepCount;
curGb.restore(initial);
runToNextInputFrameHiOrLoLimi... | 6 |
@Override
public void createFile(String parent, String newfile, FileBase thedata)
{
if (!dirEntries.containsKey(parent.toLowerCase())) return;
if (fileEntries.containsKey((parent + "/" + newfile).toLowerCase())) return;
if (dirEntries.containsKey((parent + "/" + newfile).toLowerCase())) ... | 4 |
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 isPrime(long pNumber){
boolean check = false;
long n = pNumber;
for(long i : primes ){
if(i > Math.sqrt(n)){
break;
}
while (n%i == 0) {
n /= i;
break;
}
}
if(pNumber == n){
check = true;
}
return check;
} | 4 |
@Override
public void run()
{
try
{
while (true)
{
WorldGenerator.GeneratorTask t = gen.taskQueue.take();
if (t.op == -1)
break;
// System.out.println(t.x+" "+t.z+" "+t.op);
switch (t.op)
... | 9 |
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals(EXIT_BUT))
{
System.exit(0);
}
else if (e.getActionCommand().equals(ACTION_1))
{
}
else if (e.getActionCommand().equals(ACTION_2))
{
}
else if (e.getActionCommand().equals(ACTION_3))
{
}
} | 4 |
public void test_05_choking_on_dot_slash_dot() {
initSnpEffPredictor("testCase");
String fileName = "./tests/choking_on_dot_slash_dot.vcf";
VcfFileIterator vcf = new VcfFileIterator(fileName, genome);
vcf.setCreateChromos(true);
for (VcfEntry vcfEntry : vcf) {
for (VcfGenotype gen : vcfEntry) {
boolea... | 2 |
public void setId(Integer id) {
this.id = id;
} | 0 |
@Override
public String getName() {
return this.name;
} | 0 |
public ArrayList DoubleMajor(ArrayList primary, ArrayList secondary){
ArrayList<String> majorOne = primary;
ArrayList<String> majorTwo = secondary;
boolean matchFound = false;
for(int i = 0; i<majorOne.size();i++){
for(int j = 0; j<majorTwo.size();j++){
if(majorOne.get(i).substring(majorOne.get(i).sub... | 8 |
public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... | 8 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((sortIds() == null) ? 0 : sortIds().hashCode());
return result;
} | 1 |
public boolean hasPick() {
if(playerHasItem2(1275) || playerHasItem2(1271) || playerHasItem2(1273) || playerHasItem2(1269) || playerHasItem2(1267) || playerHasItem2(1265))
{
return true;
}
return false;
} | 6 |
public boolean isSameTreeR(TreeNode p, TreeNode q) {
if (p==null || q==null)
return p==q;
return (p.val == q.val) && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
} | 4 |
public static void putIntUnsigned(ByteBuffer out, int x)
{
int more, a;
do
{
a = (x & 0x7F);
more = (x >>= 7) != 0 ? BYTE_MORE : 0;
out.put( (byte)(more | a) );
}
while (more != 0);
} | 2 |
public void handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException
{
URI uri = request.getURI();
try
{
if (log.isDebugEnabled())
log.debug("CONNECT: " + uri);
InetAddrPort a... | 7 |
@Override
public List<SkinPreviewVO> getAvailableSkins() {
cleanModel();
List<SkinPreviewVO> previews = new LinkedList<SkinPreviewVO>();
try (DirectoryStream<Path> dir = Files.newDirectoryStream(Constants.PROGRAM_SKINS_PATH)) {
for (Path path : dir) {
if (path.ge... | 4 |
public void start(BundleContext context) throws Exception {
m_context = context;
// Create a service tracker to monitor dictionary services.
m_tracker = new ServiceTracker(m_context, m_context.createFilter("(objectClass=" + SpellChecker.class.getName() + ")"), null);
m_tracker.open();
try {
System.out.pr... | 6 |
@SuppressWarnings("unused")
private void setupInterestingNodes() {
// Random number generator
Random rand = new Random();
// Coordinates for the 4 important nodes
int scannerColumn, scannerRow, predatorColumn, predatorRow, controlRow, controlColu... | 4 |
public final String getCurrentDataTime()
{
Date oCurrentDate = new Date();
SimpleDateFormat oSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss.SSSS");
return oSimpleDateFormat.format(oCurrentDate);
} | 0 |
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new MyRunnable1());
thread.start();
try {
TimeUnit.MILLISECONDS.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
MyRunnable1.sleepN... | 2 |
public static void writeBytes(final OutputStream outs, final byte[] content) throws IOException {
int currLoc = 0;
int contentLen = content.length;
BufferedOutputStream out = null;
try {
out = new BufferedOutputStream(outs, BUFFER_SIZE);
while (currLoc < contentLen) {
int len = (contentLen > currLoc +... | 5 |
public USBHost ()
throws IOException
{
super (null, null);
if ((host = HostFactory.getHost ()) == null)
throw new RuntimeException ("USB is not available");
busses = new Bus [0]; // NPE guard
host.addUSBListener (new USBListenerProxy (this));
busses = host.getBusses ();
// XXX want r... | 2 |
protected static void setRoomPart1() {
if (current != null) {
ArrayList<Entity> entities = Entity.getEntities();
for (Entity entity : entities) entity.onRoomEnd();
current.onEnd();
if (changeTo == null) for (Entity entity : entities) entity.onAppEnd();
Render.clear();
Entity.clear();
View.cle... | 6 |
public void grabdata()
{
try
{
BufferedReader in = new BufferedReader(new FileReader("masterlist.txt"));
String str;
while ((str = in.readLine()) != null)
{
Player p = readprofile(str);
if (p != null)
{
everyone.put(str.toLowerCase(), p);
norder.add(p);
}
}
in.close();
... | 4 |
private static void addTrees(String[] paths, String[] folders, String[] name, String type){
for(int i=0;i<paths.length;i++){
try {
@SuppressWarnings("unused")
TreeWorker tree = new TreeWorker( paths[i], folders[i], name[i], type, true, true);//save=true ,it saves itself
} catch (IOException e) {
... | 2 |
public static void startupRules() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module... | 6 |
public Canvas(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "height":
height = Height.parse(this, v);
break;
case "width":
width = Width.parse(this, v);
br... | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof UserOrganisationMembership)) {
return false;
}
UserOrganisationMembership other = (UserOrganisationMembership) object;
... | 5 |
public float[][] Fillzero2D(float[][] fill){
int ii = fill.length;
int jj = fill[0].length;
for (int i= 0; i< ii; i ++){
for (int j=0; j<jj; j++){
fill[i][j] = 0;
}
}
return fill;
} | 2 |
private static boolean testBasicNodeMethods() {
try {
if ( PhylogenyNode.getNodeCount() != 0 ) {
return false;
}
final PhylogenyNode n1 = new PhylogenyNode();
final PhylogenyNode n2 = new PhylogenyNode( "", TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
... | 9 |
@Override
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
final String ent1 = arg.get("ENT1").get(1);
final String ent2 = arg.get("ENT2").get(1);
final Entity cl1;
final Entity cl2;
final Entity normalEntity;
final String suffix = "lol" + UniqueSequence.getValue();
if... | 9 |
public static Float getFltParam(SessionRequestContent request, String name){
String param = (String) request.getParameter(name);
if (param != null && !param.isEmpty()) {
Float currParam = Float.parseFloat(param);
return currParam;
}
return null;
} | 2 |
@Override
public int read(String path, Object fh, ByteBuffer buf, long offset) throws FuseException {
FileHandle handle = (FileHandle)fh;
//a workaround (for a bug?)
if (handle == null)
return Errno.EBADSLT;
if (handle.hasClosed)
return Errno.EBADSLT;
if (handle.isEmptyFile)
return 0;
if (!handle.... | 4 |
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 _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Token other = (Token) obj;
if (token == null) {
if (other.token != null)
return false;
} else if (!token.equals(other.token))
return ... | 6 |
public synchronized void close() {
// lock the thread for closing
closingLock.writeLock().lock();
List<Callable<Boolean>> taskList = new ArrayList<>();
int size = queue.size();
final CountDownLatch count = new CountDownLatch(queue.size());
for(int i=0;i<size;i++)
{
taskList.add(new Callable<Boolean>() ... | 3 |
@Override public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s==Quit) {
MenuHandler.CloseMenu();
Game.gui.LoginScreen();
}
else if (s==EndTurn) {
MenuHandler.CloseMenu();
Game.btl.EndTurn();
}
else if (s==Resume) {MenuHandler.CloseMenu();}
else if (s==Save) {Game.save.S... | 5 |
@Override
protected String makeString(String t, boolean structured) {
String n = ""; //new line
String tt = ""; //tabulators
//create new stuff, if structured
if(structured){
n = "\n";
tt = t+"\t";
}
//temp storage
StringBuilder objsb = new StringBuilder();
//trick to h... | 3 |
public Point2D getNormalAt( double position ) {
if( position < 0 || position > 1 ) {
throw new IllegalArgumentException( "position out ouf range: " + position );
}
int segment = segmentAt( position );
Point2D start = segments[segment];
Point2D end = segments[segment + 1];
double distance = segmentLeng... | 3 |
public void Run () throws InvalidFileFormatException, IOException
{
// Menu actions
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("List action: ");
System.out.println("1. Go to Angry Bird");
System.out.println("2. Action Robot");
System.out.println("3. Visual... | 9 |
private boolean valueSearchNull(Entry n) {
if (n.value == null)
return true;
// Check left and right subtrees for value
return (n.left != null && valueSearchNull(n.left)) ||
(n.right != null && valueSearchNull(n.right));
} | 4 |
private String wordToString(AbstractComponent component)
throws BookException {
StringBuilder sb = new StringBuilder();
try {
Iterator<AbstractComponent> iterator = component.getIterator();
while (iterator.hasNext()) {
AbstractComponent c = iterator.next();
sb.append(characterToString(c));
}
}... | 2 |
private void PrintCurrentRoomItems() {
Iterator<String> iter = currentRoom.GetItems().iterator();
while (iter.hasNext()) {
System.out.print(iter.next());
if (iter.hasNext()) {
System.out.print(", ");
}
}
// Set up to print the containers
if (! currentRoom.GetContainers().isEmpty()) {
if (! cur... | 4 |
public DefaultComboBoxModel<String> buildSlotList(int type) {
Equipment equipment = new Equipment();
DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>();
switch(type) {
case(1):
for(int x = 0; x<equipment.getArmor().getSlotNames().length; x++) {
comboBoxModel.addElement(equipm... | 4 |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
args = CommandLineTokenizer.tokenize(args);
if (sender instanceof Player) {
xAuthPlayer p = plugin.getPlyrMngr().getPlayer((Player) sender);
if (args.length < 1) {
plugin.getMsgHndlr().sendMessage("login.usage... | 9 |
@EventHandler
public void GiantResistance(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.getGiantConfig().getDouble("Giant.Resista... | 6 |
@MethodInformation(author="Wolfgang", date="09.12.2012", description="Gives back a double that describes the average of all used Diesel of all fertilizing DieselTraktor")
protected double avgDieselTraktorFertilizing() throws DivideByZeroException {
MyIterator it = (MyIterator) traktoren.iterator();
double sum = 0;... | 4 |
public static boolean checkLength(long length, WSDLColType colType) {
switch (colType) {
case DESCRIPTION:
if (length < 10000) {
return true;
} else {
return false;
}
case TITLE:
if (l... | 9 |
private void updateList(String path) {
File[] files = new File(path).listFiles();
this.path = path;
if (files != null)
((FileTable) FileView).addFiles(files);
} | 1 |
public double getAmountPaid() {
return amountPaid;
} | 0 |
@Override
public List<Double> untransform(List<Double> in) {
if (in.size() != inputMins.size()) {
throw new MLException(String.format(
"Unexpected in-vector size. Expected: %d, Got: %d", inputMins.size(), in.size()));
}
List<Double> out = new ArrayList<Double>... | 4 |
int getNextNonWhitespace(int start)
{
char curChar;
int offset = -1;
int retOffset = -1;
do
{
offset ++;
retOffset ++;
if(start + offset >= input.getText().length()) return retOffset-1;
curChar = input.getText().charAt(start + offset);
if(curChar == '\r') retOffset --;
}
while(cu... | 6 |
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.