text stringlengths 14 410k | label int32 0 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 void buyStock(String symbol, int quantity) throws BalanceException,
StockNotExistException {
boolean buyStockSucsses = false;
int stockSymbolIndex = 0;
if (balance <= 0) {
throw new StockNotExistException(symbol);
}
// find the index of symbol
for (int i = 0; i < portfolioSize; i++) {
if (s... | 5 |
private String timeToString(long seconds) {
long minutes = seconds / 60;
seconds = seconds - minutes*60;
if (minutes == 0 && seconds == 0)
return "zero seconds";
else if (minutes == 0)
return secondsToString(seconds);
else if (seconds == 0)
re... | 4 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
Neuron neur;
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setPaint(Color.lightGray);
for(int i=0;i<Data.ge... | 6 |
public void unzip(String zipFile, String id) throws Exception {
downloadPack.passwordLbl.setText("Extracting Files");
Console.log("Extracting " + id.replace("_", " ") );
downloadPack.progress.setValue(0);
int BUFFER = 2048;
File file = new File(zipFile);
Zi... | 5 |
public static File downloadFileTo(String urlString, String ext, File dir) throws IOException {
InputStream in = null;
OutputStream out = null;
File file = null;
if (!dir.exists()) { // If the download directory does not exist, we create it.
dir.mkdirs();
}
try {
in = openURLStream(urlStrin... | 5 |
@Override
public void run() {
System.out.println("\tNew connection handler thread is running");
while (true) {
HttpContext context = new BasicHttpContext(null);
try {
while (!Thread.interrupted() && this.conn.isOpen()) {
this.h... | 7 |
@Override
public Sala clone() {
return new Sala(this);
} | 0 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public void setZip(String zip) {
this.zip = zip;
} | 0 |
public Shape createStrokedShape( Shape shape ) {
GeneralPath result = new GeneralPath();
shape = new BasicStroke( 10 ).createStrokedShape( shape );
PathIterator it = new FlatteningPathIterator( shape.getPathIterator( null ), FLATNESS );
float points[] = new float[6];
float moveX ... | 6 |
public double rawAllResponsesMinimum(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawAllResponsesMinimum;
} | 2 |
@Override
public Object getItem(){
parent.zoomSlider.setValueIsAdjusting(true);
String editorText = editor.getText();
int newVal =0;
if(editorText!=null){
if(editorText.toLowerCase().endsWith("fit")) parent.zoomSlider.setValue(0);
else{
StringB... | 6 |
public String toString() {
StringBuilder s = new StringBuilder();
for (Planet p : planets) {
// We can't use String.format here because in certain locales, the ,
// and . get switched for X and Y (yet just appending them using the
... | 1 |
private boolean isBecomeFull() {
// Was ready, but become not
boolean wasReady = ready;
ready = isReady();
return (wasReady && !ready);
} | 1 |
@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 Listas)) {
return false;
}
Listas other = (Listas) object;
if ((this.iLista == null && other.iLista != null) ||... | 5 |
protected boolean collision(int xa, int ya) {
boolean solid = false;
if (getDir() == 0) {
if (level.getTile((x + xa) / 16, (y + ya) / 16).solid()) solid = true;
}
if (getDir() == 1) {
if (level.getTile(((x + xa) / 16) + 1, (y + ya) / 16).solid()) solid = true;
}
if (getDir() == 2) {
if (level.getTi... | 8 |
public static void unhideNeighborEmptyCells(BoardModel boardModel, Cell currentCell) {
currentCell.setVisible(true);
for (int i = currentCell.getPositionX() - 1; i <= currentCell.getPositionX() + 1; i++) {
for (int j = currentCell.getPositionY() - 1; j <= currentCell.getPositionY() + 1; j++... | 8 |
public static void main(String[] args){
// création des deux listes
int i=0;
List<AR> AR = new ArrayList<AR>();
List<AS> AS = new ArrayList<AS>();
Calcul.RepriseTableau(AR, AS);
Saisie saisie = new Saisie(AR);
boolean saisieOK = false;
do
{
i =0;
boolean trouve= false;
while (!trouve && i < A... | 5 |
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
resp.setContentType("text/plain");
AppIdentityCredential credential = new AppIdentityCredential(
AnalysisConstants.SCOPES);
String bigqueryProjectId = AnalysisUtility.extractParameterOrThrow(req,
AnalysisConstants.BIGQUERY_PROJECT_ID_... | 7 |
public static boolean hitPlane(SpaceRegion region, Direction plane,
Vec3 position, Vec3 direction) {
Vec3 normal = null;
Vec3 p0;
Vec3 p1;
float D; //because math.
Vec3 pointInPlane;
//Extracting each plane can, for once, be done with some trickery.
//also, notice how N and S have the same plane, wi... | 6 |
public int getBiome() {return biome;} | 0 |
public void draw(Graphics2D g) {
drawAura(g);
Shape ellipse = new Ellipse2D.Double(x - radius, y - radius, 2 * radius, 2 * radius);
if (getInitial() != 0) {
ellipse = new Rectangle2D.Double(x - radius, y - radius, 2 * radius, 2 * radius);
}
g.setColor(color);
... | 3 |
public V remove(K key) {
V val = get(key);
if (val == null) {
return null;
}
// removeAt(keys, currentIndex);
// removeAt(values, currentIndex);
checkEnoughCapacity(1);
// Switch the chosen element and the last one
exchangeWithLast(keys, cur... | 1 |
public void start()
{
timer.start();
} | 0 |
@Override
public Event next() {
try {
input = br.readLine();
} catch (IOException e1) {
}
if(input == null || input.equals(""))
{
return new UserHomeState(as, name);
}
else{
try{
as.bid(name, Long.parseLong(input));
}
catch(Exception e){
return new SearchResultsState(as,... | 4 |
@Override
public void exec(CommandSender sender, String commandName, String[] args, Player player, boolean isPlayer) {
String staffChatMessage = "";
if (!isPlayer) {
sender.sendMessage(ChatColor.RED + "Run this command from ingame.");
return;
}
if (!player.h... | 6 |
public void blink() {
if (getWorld().getObjects(Dolphin.class).size() != 0) {
getXD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getX();
getYD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getY();
setLocation(getXD - 15 ,getYD - 25);
}
... | 6 |
public void propagateValues(List<String> cliValues) {
int argValueIdx = 0;
int valueIdx = 0;
while (argValueIdx < cliValues.size()) {
if (argValueIdx >= values.size()) { // more data then values ... abort
break;
} else {
IValue<?> value ... | 5 |
private void loadPreferences()
{
Preferences preferences = BrainPreferences.getPreferences();
if (preferences != null)
{
String leftName = preferences.get(PreferencesNames.LEFT_NAME, "");
String rightName = preferences.get(PreferencesNames.RIGHT_NAME, "");
... | 1 |
private static void checkAndDeleteDir(FileSystem fileSystem, String directory) throws TestFailedException {
try {
if (fileSystem.pathExists(directory))
fileSystem.deleteDirectoryRecursively(directory);
if (fileSystem.pathExists(directory))
throw new TestFailedException("I deleted the directory " + d... | 4 |
private static boolean isAssignable(Class<?>[] formal, Class<?>[] actual) {
if (formal.length != actual.length) {
return false;
}
for (int i = 0; i < formal.length; i++) {
if (actual[i] == null) {
if ((formal[i].equals(int.class))
... | 9 |
private void processBody(HttpURLConnection conn) throws Exception{
if(type == HttpResponseType.RAW){
data = conn.getInputStream();
}else{
final BufferedReader input = new BufferedReader(new InputStreamReader(conn.getInputStream()));
switch(type){
//return raw input stream.
case RAW:
assert fal... | 8 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Parameter that = (Parameter) obj;
i... | 9 |
protected boolean writeClass(ClassWriter classWriter, String className)
throws IOException, ConstantPoolException {
JavaFileObject fo = open(className);
if (fo == null) {
reportError("err.class.not.found", className);
return false;
}
ClassFileInfo cfI... | 9 |
private static void writeMapObject(MapObject mapObject, XMLWriter w, String wp)
throws IOException
{
w.startElement("object");
w.writeAttribute("name", mapObject.getName());
if (mapObject.getType().length() != 0)
w.writeAttribute("type", mapObject.getType());
w.... | 4 |
private List<String> verifyBracketTokens(List<String> tokens) throws ParserException {
List<String> newTokens = new ArrayList<String>();
int bracketType = -1;
String[] brackets = null;
for (int i = 2; i < tokens.size() && bracketType < 0; i++) {
if (!"".equals(tokens.get(i))) bracketType = i;
}
switch (b... | 7 |
private static void closeConnection() {
try {
if (resultSet != null)
resultSet.close();
if (preparedStatement != null)
preparedStatement.close();
if (preparedStatement2 != null)
preparedStatement2.close();
if (preparedStatement3 !=... | 6 |
private static Object findJarServiceProvider(String factoryId) throws ConfigurationException {
String serviceId = "META-INF/services/" + factoryId;
InputStream is = null;
// First try the Context ClassLoader
ClassLoader cl = ClassLoaderSupport.getContextClassLoader();
if (cl != ... | 7 |
public static void main(String args[]) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(int N;(N=parseInt(in.readLine().trim()))!=0;){
TreeMap<int[],Integer> mapa=new TreeMap<int[],Integer>(new Comparator<int[]>(){
public in... | 8 |
public static List<Inaugurador> listaDeInauguradores() {
ResultSet tr = null;
String select = "SELECT * FROM cargo_inaugura";
ArrayList<Inaugurador> listaInaugurador = new ArrayList<Inaugurador>();
Connection conexion = null;
Statement statement = null;
try {
... | 9 |
@Override
public void shoot(){
for(Weapon<? extends actor.ship.projectile.Projectile> weapon : weapons){
weapon.shoot(this, Vector3f.newRandom(1));
}
} | 2 |
public Vector2D unitVector(){
float mag = magnitude();
if (mag == 0) return new Vector2D(0,0);
float newX = x/mag;
float newY = y/mag;
return new Vector2D(newX,newY);
} | 1 |
public void loadSprite(String ref) {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/sprites"));
String line;
while((line = reader.readLine()) != null) {
final String[] temp = line.split(";");
if(temp[0... | 4 |
public final Instances resampleWithWeights(Instances data,
Random random,
boolean[] sampled) {
double[] weights = new double[data.numInstances()];
for (int i = 0; i < weights.length; i++) {
weights[i] = data.instance(i).weight();
}
Instances newData = new Instances(data, data... | 8 |
public static List<CDDFeature> removeOverlaps(List<CDDFeature> features) {
List<CDDFeature> newFeatures = new ArrayList<CDDFeature>();
CDDFeature lastFeature = null;
Collections.sort(features);
for (CDDFeature feature: features) {
// System.out.println("Looking at "+hit);
if (lastFeature == null || featur... | 7 |
public static void seq_e(CompList<?> t) {
for (Compound c : t) {
c.execute();
}
} | 2 |
public void open() {
System.out.println(WELCOME);
System.out.println(USE_HELP);
request = getCommand();
while (!request.equals(EXIT_COMMAND)) {
if (request.equals(HELP_COMMAND)) {
for(int i = 0; i < COUNT_OF_COMMANDS; i++) {
System.out.pri... | 6 |
public String retrieveTemplate(String catalogLink, String templateName) throws Exception{
String response = doGet(catalogLink);
String catalogItemLink = findElement(response, Constants.CATALOGITEM, Constants.CATALOGITEM_LINK, templateName);
response = doGet(catalogItemLink);
String element = findElement(resp... | 1 |
public ListNode reverseBetween(ListNode head, int m, int n) {
if(m==n) return head;
ListNode start = null;
ListNode beforestart = null;
ListNode curr = null;
for(int i=0; i<m-1; i++)
{
beforestart = beforestart==null?head:beforestart.next;
}
start = be... | 7 |
protected String compute() {
if (element == null) return null;
switch (element.getType()) {
case OBJECT: return serializeObject();
case ARRAY: return serializeArray();
case STRING: return serializeString((String)element.getData());
... | 8 |
private static File initMap() throws IOException {
String map
= "...?????...\n"
+ ".#.#?#?#.#.\n"
+ "..???????..\n"
+ "?#?#?#?#?#?\n"
+ "????.$.????\n"
+ "?#?#$$$#?#?\n"
+ "????.$.????\n"
... | 0 |
public static float[][] getSecondCenter(float[][] X, int min, int max) {
int i = max - min + 1;
float tempX[][] = new float[i][X[0].length];
float tempY[][] = new float[i][X[0].length];
// float temp = 0;
for (int t = 0; t < i; t++) {
for (int k = 0; k < X.length; k++) {
// decide whether the point bel... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
Response response = null;
if (messageForm.getFromTextField().trim().length() < 1
|| messageForm.getToTextField().trim().length() < 1
|| messageForm.getSubjectTextField().trim().length() < 1
|| mes... | 7 |
private void grabSequenceAndOutput() throws IOException{
BufferedWriter out = new BufferedWriter(new FileWriter(outputDirectory + "/" + "SEQ_" + annotationFile.substring(annotationFile.lastIndexOf('/') + 1, annotationFile.lastIndexOf('.')) + ".fasta"));
Sequence_DNA seq = null;
int currentSequence = 0;
... | 8 |
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 Client(int port) {
String input = null;
int inputOption = 0;
boolean validInput = false;
System.out
.println("Wählen sie zwischen Host(1), Verbindung(2) oder Computergegner(3).");
while (!validInput) {
try {
input = Eingabe.getEingabe().getUserInput();
} catch (Exception e) {
// N... | 6 |
public int getFlag(final OffsetPoint n) {
final int x = n.getX() - offset.getX();
final int y = n.getY() - offset.getY();
if (x >= 0 && y >= 0 && x < flags.length && y < flags[x].length) {
return flags[x][y];
} else {
return -1;
}
} | 4 |
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int times = in.nextInt();
for (int i = 0; i < times; i++) {
int nCoins = in.nextInt();
int[] c = new int[nCoins];
for (int j = 0; j < c.length; j++)
c[j] = in.ne... | 8 |
@Override
public void mouseClicked(MouseEvent e) {
Point mouseGridPosition = board.getPosOnGrid(new Point(e.getPoint()));
for (Enemy currentEnemy : board.getAllEnemiesInCurrentWave()) {
if( currentEnemy.isWithinObject(new Point(e.getPoint())) && currentEnemy.isAlive()) {
... | 6 |
* @return Returns true if the given edge may be splitted by the given
* cell.
*/
public boolean isSplitTarget(Object target, Object[] cells)
{
if (target != null && cells != null && cells.length == 1)
{
Object src = model.getTerminal(target, true);
Object trg = model.getTerminal(target, false);
retu... | 7 |
public static void trackRemove(String tag) {
if(!trackedTags.containsKey(tag) && !trackedTags.remove(tag)) {
System.out.println("[Debugger] Tag " + tag + " was not being tracked.");
} else {
trackedTags.remove(tag);
System.out.println("[Debugger] Tag " + tag + " is no longer tracked.");
}
} | 2 |
protected static Integer parseInteger(final Object obj, final String type) throws ParseException {
final Integer result;
try {
result = Integer.valueOf(obj.toString());
} catch (NumberFormatException nfe) {
throw new ParseException(obj + " is not a valid " + type + ".");
}
return result;... | 1 |
public byte[] readBinaryFromFile( String filename )
{
RandomAccessFile f = null;
try { f = new RandomAccessFile( new File( filename ),"r"); }
catch (FileNotFoundException e1) { e1.printStackTrace(); }
byte[] b = null;
try { b = new byte[ (int) f.length() ]; } catch (IOException e) { e.printStackTrace(); }
... | 4 |
public static MapaTuberias fromElement(Node tuberias, Mapa mapa, Dinero d) throws NoSeCumplenLosRequisitosException, FondosInsuficientesException, SuperficieInvalidaParaConstruir, CoordenadaInvalidaException {
MapaTuberias mapaTuberias = new MapaTuberias(mapa);
NodeList hijosDeRed = tuberias.getChildNodes();
for... | 7 |
private static String cut_the_pattern(String lemma_sentence) {
String[] lemma_sentence_tokens = lemma_sentence.split(" ");
String final_pattern = "";
Boolean found = false;
for(int i = 0; i < lemma_sentence_tokens.length; i++){
if(i+1 < lemma_sentence_tokens.length && lemma_sentence_tokens[i+1].equals("<S... | 6 |
public boolean testValue(double val)
{
return (mmin <= val && val <= mmax);
} | 1 |
public static int min (int[] element)
throws IllegalArgumentException
{
if (element.length == 0) {
throw new IllegalArgumentException ("tom samling");
}
int[] sekvens = element;
int antaletPar = sekvens.length / 2;
int antaletOparadeElement = sekvens.length % 2;
int antaletTankbaraElement = antal... | 5 |
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ArrayStack<Integer> temp = new ArrayStack<Integer>(15);
Integer[] h= new Integer[3];
h[0]=8;
h[1]=9;
h[2]=10;
System.out.println("Add elements:");
for(int i = 0; i <8; i++) temp.add... | 3 |
public static double getOperationDiscount(EditOperation editOperation, int previousEdits) {
double discount = 1;
if(previousEdits > 0){
int edits = previousEdits;
switch (editOperation){
case Insert:
discount = 0.33/ edits;
... | 5 |
private void readAbilities(String path, DataModel dataModel) {
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File(path));
// normalize text representation
d... | 7 |
public void checkCollision() {
for (int i = 0; i < people.length; i++)
for (int j = i+1; j < people.length; j++)
if (people[i].colliding(people[j]))
people[i].collide(people[j]);
} | 3 |
* @param unit The <code>Unit</code> to unload.
* @param goods The <code>Goods</code> to unload.
* @return An <code>Element</code> encapsulating this action.
*/
public Element unloadCargo(ServerPlayer serverPlayer, Unit unit,
Goods goods) {
ChangeSet cs = new Cha... | 6 |
public Point3 multiply(double multiplier) {
x *= multiplier;
y *= multiplier;
z *= multiplier;
return this;
} | 0 |
public void run() {
Object[] i = this.getCars().toArray();
for(Object o: i) {
Vehicle v = (Vehicle)o;
remove(v);
v.setDisposed();
v = null;
}
_ts.enqueue(_ts.currentTime() + MP.simulationTimeStep, this);
} | 1 |
private void mainRequest(){
final JSONHandler webHandle = new JSONHandler( this.MCAC );
final HashMap<String, String> url_items = new HashMap<String, String>();
url_items.put( "maxPlayers", String.valueOf( this.MCAC.getServer().getMaxPlayers() ) );
url_items.put( "version", this.MCAC.getDescription().getVersion... | 8 |
public LoginViewHelper getLoginViewHelper(HttpServletRequest req)
throws UnsupportedEncodingException {
LoginViewHelper loginViewHelper = new LoginViewHelper();
if (req.getParameter("email") != null) {
loginViewHelper.setEmail(new String(req.getParameter("email")
.getBytes("iso-8859-1"), "UTF-8"));... | 2 |
public static int test(Object channel, long action, Object ... args) {
System.out.println("Sending action:" + action + " across channel:'" + channel.toString() + "'");
int returnCode = 0;
if(args.length > 0) {
System.out.println(" Arguments:");
for(Object arg:args)
... | 8 |
private static void lisaaOliotListoihin(HashMap<String, Kayttaja> kayttajat, String nimimerkki, Kayttaja kayttaja, HashMap<String, KenttaProfiili> profiilit, String kenttaProfiiliNimi, KenttaProfiili profiili) {
if (!nimimerkki.equals("Anon") &&!kayttajat.containsKey(nimimerkki)) {
kayttajat.put(nim... | 5 |
private void updateEntities(double deltaTime) {
for (Entity entity : entities) {
entity.update(deltaTime);
}
} | 1 |
public void setDepartureEnd(int value) {
this._departureEnd = value;
} | 0 |
public static void main(String[] args) {
// TODO code application logic here
} | 0 |
public static File[] save(Saveable saveable) {
if (saveable == null) {
return new File[0];
}
File file = saveable.getBackingFile();
if (file != null) {
File[] files = saveable.saveTo(file);
for (File one : files) {
RecentFilesMenu.addRecent(one);
}
return files;
}
return SaveAsCommand.sa... | 3 |
public MOB getAnyElligibleOfficer(Law laws,
Area myArea,
MOB criminal,
MOB victim)
{
final Room R=criminal.location();
if(R==null)
return null;
if((myArea!=null)&&(!myArea.inMyMetroArea(R.getArea())))
return null;
MOB M=getElligibleOfficerHere(laws,myArea,R,criminal,victi... | 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 |
@Basic
@Column(name = "FES_ID_FUNCIONARIO")
public Integer getFesIdFuncionario() {
return fesIdFuncionario;
} | 0 |
@Test
@TestLink(externalId="testCreateTimeStamp")
public void testCreateTimeStamp() {
final TimeZone timeZoneUTC = TimeZone.getTimeZone("UTC");
TimeZone.setDefault(timeZoneUTC);
final Calendar calendar = Calendar.getInstance(timeZoneUTC, Locale.US);
calendar.setTimeInMillis(0);
... | 0 |
static PortWatcher getPort(Session session, String address, int lport) throws JSchException{
InetAddress addr;
try{
addr=InetAddress.getByName(address);
}
catch(UnknownHostException uhe){
throw new JSchException("PortForwardingL: invalid address "+address+" specified.", uhe);
}
synch... | 7 |
public Submit getSubmit() {
return submit;
} | 0 |
private static <T> String makePrimitiveStrings(String className, T value) {
StringBuilder result = new StringBuilder();
if (className.equals("java.lang.Short"))
return result + value.toString() + "S";
else if (className.equals("java.lang.Long"))
return result + value.toString() + "L";
else if (className.... | 5 |
protected void computeFloor(final float[] vector) {
int n=vector.length;
final int values=xList.length;
final boolean[] step2Flags=new boolean[values];
final int range=RANGES[multiplier-1];
for(int i=2; i<values; i++) {
final int lowNeighbourOffset=lowNeighbours[i];//Util.lowNe... | 9 |
public static void normalizeExistsProposition(Proposition self) {
{ Proposition whereproposition = ((Proposition)((self.arguments.theArray)[0]));
{ Object old$Evaluationmode$000 = Logic.$EVALUATIONMODE$.get();
try {
Native.setSpecial(Logic.$EVALUATIONMODE$, Logic.KWD_DESCRIPTION);
... | 9 |
private double doNamedVal(int beg, int end) {
while(beg<end && Character.isWhitespace(expression.charAt(end))) { end--; } // since a letter triggers a named value, this can never reduce to beg==end
String nam=expression.substring(beg,(end+1));
Double va... | 5 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof Room))
{
final Room R=(Room)affected;
if((R.myResource()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_VEGETATION)
for(int m=0;m<R.numInhabitants();m++)
{
final MOB M=R.fetchInhabitant(m);... | 9 |
public void run() { //this will be ran every 10 seconds
//get difference in area
//update hitpoints
//if print count is 6 then print scores and set to 0
//if hitpoints = 0 or 100i am
//declare a winner
//else
//set to call again another 10 seconds
//set printcount to 0
... | 6 |
private static Cell construct(Sequence s1, Sequence s2, float[][] matrix,
float o, float e, byte[] pointers, int[] lengths) {
logger.info("Started...");
char[] a1 = s1.toArray();
char[] a2 = s2.toArray();
int m = s1.length() + 1; // number of rows in similarity matrix
int n = s2.length() + 1; // number ... | 9 |
public boolean nextMove(int row, int col) {
HashMap<Integer, Coords> choices = new HashMap<Integer, Coords>();
//Returns true for a valid and successful move
boolean result = false;
int r = game.getBoard().board_row;
int c = game.getBoard().board_col;
int highest_flips = ... | 6 |
public static boolean validarLogin(Usuario[] usuarios) {
Scanner sc = new Scanner(System.in);
String user = "";
String password = "";
System.out.println("Digite seu login: ");
user = sc.nextLine();
System.out.println("Digite sua senha: ");
password = sc.nextLine()... | 4 |
public static String formatOutput(JSONObject obj) {
String ausgabe = "";
JSONObject result = new JSONObject();
try {
result = obj.getJSONObject("result"); // result ist unser Referenz
// JSON-Objekt. von da aus
// erreichen wir alle Daten
ausgabe = getStringOutputLine("Produktname"... | 5 |
public void tick(double time) {
if (activationTime <= time && alive) {
setActive(true);
for (GameAction currentAction : getGameActions()) {
currentAction.tick(this);
}
moveEnemy(enemyPixelMovement(enemyPathing.getCurrentPixelGoal()));
... | 8 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.