text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static String numberToString(Number number)
throws JSONException {
if(number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if(string.indexOf('.') > 0 && string.indexO... | 6 |
@Override
public void run(CommandSender sender, String maincmd, String[] args)
{
if (sender instanceof Player && !sender.hasPermission("mobmanager.admin"))
{
sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to use /mm saveitem");
return;
}
if (!(sender instanceof Player))
{
se... | 7 |
public void printNodeArray(ArrayList<Integer> nodes) {
System.out.println();
for (int i = 0; i < nodes.size(); i++) {
System.out.print(" " + nodes.get(i).toString() + " ");
}
System.out.println();
} | 1 |
public static ArrayList<Question> parseJson(String str) throws Exception
{
ArrayList<Question> qs = new ArrayList<Question>();
JSONParser parser = new JSONParser();
String[] lines = str.split("\n|\r");
for(String line : lines)
{
Question q = new Question(... | 9 |
public Grid extend(PointDouble values) {
double minX;
double maxX;
double minY;
double maxY;
double distance;
Grid result;
// left
if (Utils.smOrEq(values.getX(), getMinX())) {
distance = getMinX() - values.getX();
// exactly on grid point?
if (Utils.eq(distance... | 9 |
private static void addotuToFamily(HashMap<String, String> map, File f) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(f));
reader.readLine();
for(String s= reader.readLine(); s != null; s = reader.readLine())
{
String[] splits = s.split("\t");
String lastToken = ... | 6 |
public boolean applyChangeset(Changeset changeset) {
boolean status = true;
// First clear resources (if any)
if (changeset.triplesCleared() > 0) {
boolean status_c = executeClearResources(changeset.getCleared());
logger.info("Patch " + changeset.getId() + " CLEARED " +... | 8 |
public final int getColumnCount() {
return columns;
} | 0 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
private String eliminateEscapes(String s) {
StringBuilder b = new StringBuilder();
boolean prevSlash = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (!prevSlash) {
if (c == '\\') {
prevSlas... | 8 |
public String getAccountId() {
return accountId;
} | 0 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((players == null) ? 0 : players.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
} | 2 |
public void setEditable(boolean editable) {
frozen = !editable;
} | 0 |
public TestConfig(Map props) throws Exception {
this.props = props;
} | 0 |
public static void main(String[] args) {
IterableBlockWorld world = new BlockWorldImpl();
IsoBlockCanvas c = new IsoBlockCanvas(world);
c.setScale(22);
c.setZScale(1.0);
int zz = 4;
int w = 10;
for (int i = -w; i <= w; i++) {
if (Math.abs(i) != w) {
for (int z = 1; z < zz; z++) {
world.add(ne... | 8 |
public List<ComboBoxInterface> getComboBoxInterfaceList()
{
List<ComboBoxInterface> list = new ArrayList<ComboBoxInterface>();
try {
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM teacher");
while(rs.next())
{
list.add(getTeacherFromRS(rs));
}
rs.close();
} catch (SQLExce... | 2 |
public SearchPanel(DataAccess manager) {
super();
this.manager = manager;
initialize();
} | 0 |
@EventHandler
public void onEntityInteract(EntityInteractEvent event) {
Entity ent = event.getEntity();
Block block = event.getBlock();
if(ent instanceof Arrow) {
Arrow arrow = (Arrow)ent;
if(block.getType() == Material.WOOD_BUTTON) {
if(arrow.getShooter() instanceof Player) {
Player player = (Pla... | 9 |
public void addParametersCost(NodeArgument[] params, double cost) {
this.costTable.put(NodeArgumentArray.getNodeArgumentArray(params), cost);
// set the min and the max
if ((cost != Double.NEGATIVE_INFINITY) && (cost != Double.POSITIVE_INFINITY)) {
if (this.minCost == null || cost ... | 6 |
public StdMenuBar() {
for (MenuProvider provider : MENU_PROVIDERS) {
add(provider.createMenu());
}
} | 1 |
@Override
public boolean halt(Event lastEvent, OurSim ourSim) {
boolean halt = true;
List<Job> finishedJobsList = new LinkedList<Job>();
for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) {
if (entity instanceof Broker) {
Broker broker = (Broker) entity;
List<Jo... | 6 |
@Override
public Iterator<Integer> iterator()
{
return new Iterator<Integer>()
{
private int mCurrent = -1;
@Override
public boolean hasNext()
{
return findNext() != -1;
}
@Override
public Integer next()
{
mCurrent = findNext();
return mCurrent;
}
private int ... | 3 |
protected void processActionEvent(ActionEvent e) {
if(actionListener != null) {
actionListener.actionPerformed(e);
}
} | 1 |
@Override
public void run()
{
running = true;
while (running)
{
try
{
switch (functionStep)
{
case ONE:
{
long[] values = stepOneQueue.take();
s... | 6 |
public static void updateTexture(Sprite sprite,int numero, int direction){
IntRect rect ;
if(sprite instanceof Mob) {
compteurAnimation[numero]++;
if (compteurAnimation[numero] == 40)
compteurAnimation[numero] = 0;
//System.out.println(compteurAnimati... | 6 |
public void put(int hash, Object o) {
if (size++ > threshold)
grow();
modCount++;
int slot = Math.abs(hash % buckets.length);
// /#ifdef JDK12
Bucket b = new Bucket(o, queue);
// /#else
// / Bucket b = new Bucket(o);
// /#endif
b.hash = hash;
b.next = buckets[slot];
buckets[slot] = b;
} | 1 |
private void addNumbers(Block[][] block) {
for (int i = 0; i < block.length; i++) {
for (int j = 0; j < block.length; j++) {
if (block[i][j] instanceof Mines) {
// Numbers of mines on that Mines Block
int index = ((Mines) block[i][j]).getNumOfMines();
for (int a = i - 1; a <= i + 1; a++) {
... | 6 |
public String getFormTrackArtist(int formTrackNumber) throws SQLException
{
List<Track> trackRepTracks = new LinkedList<Track>();
for (Track t : getTracks())
if (t.getFormTrackNumber() == formTrackNumber)
trackRepTracks.add(t);
Set<Groop> grpset = new TreeSet<Groop>();
g... | 5 |
@Override
protected int[] ParsePosition( String ToParse )
{
int Position[] = { 0, 0 };
if( ToParse.length() == 2 )
{
switch( ToParse.toUpperCase().charAt( 0 ) )
{
case('A'):
... | 9 |
public String deleteRoomType(String roomType) {
Query q = em.createQuery("SELECT t from TypeEntity t");
for (Object o : q.getResultList()) {
TypeEntity p = (TypeEntity) o;
if (p.getRooms().size() == 0) {
if (p.getName().equals(roomType)) {
em... | 3 |
private int loadShader(String filename, int type) {
StringBuilder shaderSource = new StringBuilder();
int shaderID = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
shaderSource.append(line).append("\n");
}... | 3 |
public ConvertPane(AutomatonEnvironment environment, Automaton automaton) {
super(new BorderLayout());
drawer = new SelectionDrawer(automaton);
automatonPane = new AutomatonPane(drawer);
JSplitPane split = SplitPaneFactory.createSplit(environment, true, 0.6,
automatonPane, new JScrollPane(table));
automat... | 0 |
private String findInFile(String className, String stateName) {
JSONParser parser = new JSONParser();
try {
//Location of sentences.json file
Object obj = parser.parse(new FileReader("resources/nlg/sentences.json"));
//Access to a sentence
JSONObject jsonObject = (JSONOb... | 6 |
public void showSkiPassInfo() {
if (skiPassCard == null) {
System.out.println("\nYou don't have a ski-pass card!");
} else {
System.out.println("\nSki-pass info:");
System.out.println("ID\t" + skiPassCard.getID());
System.out.println("Card type\t" + skiPas... | 2 |
@Override
public void doCommand() {
GunTower gt = new GunTower(this.position.x, this.position.y, this.player);
// Can the player allow it ?
if(player.getBank().getMoney() > gt.getBuyingPrice()) {
// we add the tower to the game
Game.getInstance().getTowerManager().addTower(gt);
if (this.play... | 3 |
protected void setFitness() {
for(int i = 0; i < numberOfParticles; i++){
double currentfitness = objectiveFunction.CalculateFitness(position[i]);
fitness.put(i, currentfitness);
}
} | 1 |
public int [] getBottomLeft()
{
return bottomLeft;
} | 0 |
public static boolean dragChild(WidgetChild c, int slot) {
if (c == null || !c.visible() || !SlotData.validateSlot(slot))
return false;
WidgetChild dest = SlotData.getMainChild(slot);
if (c.hover() && c.getBoundingRectangle().contains(Mouse.getLocation())) {
Mouse.drag(dest.getCentralPoint(), 10, 10);
re... | 5 |
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stringFlavo... | 3 |
private long timeFromNodes(double alpha1, double beta1,
double alpha2, double beta2,
double pa, double pb, int nodes) {
double hg;
double p = pa*nodes + pb;
if (p>1)
p=1;
else if (p<0)
p=0;
do {
hg = hyperGamma(alpha1 , beta1 , alpha2 , beta2 ... | 3 |
@Test
public void RWRandomCarNumberTest() throws Exception {
ArrayList<UnilabsCar> in_buf = new ArrayList<UnilabsCar>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayInputStream in;
UnilabsCar[] buf = new UnilabsCar[new Random().nextInt(50)];
Writer w = new SimpleWriter(out);
Reader r;... | 5 |
public void restart() {
IIterator iter = blockCollection.getIterator();
while (iter.hasNext()) {
iter.remove(iter.getNext());
}
for (int y = 0; y <= boardSizeY; y++) {
for (int x = 0; x <= boardSizeX - 1; x++) {
tetrisMap[x][y] = 0;
}
}
score = 0;
lines = 0;
level = 1;
linesRequiredForN... | 3 |
public void stopSoundtrack() {
if (this.soundtrack != null) {
this.soundtrack.stop();
}
} | 1 |
@Override
public String process(String code) {
// filter comments, chars and strings
FilterComments fC = new FilterComments();
code = fC.process(code);
// FilterChars fCh = new FilterChars();
// code = fCh.process(code);
// FilterStrings fS = new FilterStrings();
// ... | 9 |
public void runAlgTime()
{
int numN = numNodes;
VertexPulse vi;
int di;
int ti;
int lowIterator = 0;
boolean empty;
while (Snum < numN) {
while (lowIterator < Delta) {
vi = lowLevelBuckets[lowIterator].getEntrance();
di = vi.getMaxDist();
ti = vi.getMinTime();
empty = deleteToLabe... | 8 |
public static Field findFreeNeighbour(Field currentField, Box box, Agent agent) {
Random rand = new Random();
ArrayList<Integer> possibleIndexes = new ArrayList<Integer>();
for (int i = 0; i < 3; i++) {
possibleIndexes.add(i);
}
while(!possibleIndexes.isEmpty()){
int index = possibleIndex... | 8 |
public static void main(String[] args) {
// TODO code application logic here
// 4. Dadas dos cadenas S1 y S2. Eliminar en S1 todos esos caracteres que se presentan en S2. Devolver un S1 limpio con los caracteres eliminados. Cualquier carácter se elimina tanto en mayúsculas como en minúsculas.
//Por ejemplo, da... | 5 |
public void test_25_exon_bases() {
System.out.println("Loading config file");
config = new Config("testCase", Config.DEFAULT_CONFIG_FILE);
config.loadSnpEffectPredictor();
System.out.println("Loading fasta file");
String fastaFile = "tests/testCase.fa";
String seq = GprSeq.fastaSimpleRead(fastaFile);
//... | 5 |
public void hasBeenActivated(Editor editor) {
if (editor == this) {
Code.debug("hasBeenActivated");
EditorActionManager eam = getEditorActionManager();
eam.enableFormatActions(false);
eam.enableGenericActions(true);
eam.enableDocumentActions(true);
// Test the state of the conta... | 4 |
public static void closeEntityManager() {
EntityManager m = JPAUtil.manager.get();
if (m != null) {
EntityTransaction t = m.getTransaction();
if (t.isActive()) { // TODO
// CoreLog.getInstance()
// .getLog()
// .warn("EntityManager ... | 2 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if(msg.target()==affected)
{
if((msg.tool()!=null)
&&(CMLib.dice().rollPercentage()>... | 7 |
public final WaiprParser.globalstat_return globalstat() throws RecognitionException {
WaiprParser.globalstat_return retval = new WaiprParser.globalstat_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal56=null;
Token ID57=null;
CommonTree char_literal56_tree=null;
Common... | 4 |
@Override
protected void eatCombinationTwo() {
int yellow = 0;
int red = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.YELLOW_PLANT && yellow < 1) {
it.remove();
yellow++;
}
if (pl.getType() == Plant.RED_PLANT && red < 1)... | 8 |
public DirectObjectPointer build() {
if (bean == null && fileChannel == null && mappedByteBuffer == null) {
throw new IllegalArgumentException("One of fromBean, fromFileChannel or fromMappedByteBuffer is mandatory");
}
DirectObjectPointer pointer = null;
... | 9 |
public static HashMap<String, Integer> nGramMapper(String countFile)
throws IOException {
HashMap<String, Integer> nGramMap = new HashMap<String, Integer>();
FileReader in = new FileReader(countFile);
BufferedReader br = new BufferedReader(in);
String input;
while ((input = br.readLine()) != null) {
... | 3 |
public NeuralNet() {
inputNeurons = new LinkedList<Neuron>();
/* Create a dud output neuron for safety sake. */
outputNeuron = new Neuron(new PolynomialTerm(0));
} | 0 |
protected Class getTransitionClass() {
return automata.turing.TMTransition.class;
} | 0 |
public void setOffline() {
lastSignal = System.currentTimeMillis()-2*Constants.NOT_ALIVE_INTERVAL*1000;
} | 0 |
public Integer get(int index) {
if (index < 0 || index >= size)
throw new IndexOutOfBoundsException();
return $.getInt(address + index * SIZE_OF_INT);
} | 2 |
private boolean onkoNopeusToistaKohti(Pelihahmo h){
double toisenSuunta = normalisoi(hahmojenValinenKulma(h));
double nopeus = normalisoi(nopeudenSuunta(h));
return nopeus > toisenSuunta - Math.PI/2 && nopeus < toisenSuunta + Math.PI/2;
} | 1 |
private void doNewKompetens() {
// check so eveything is ok
if (!Validate.tfEmpty(tfBenamning)) {
if (Validate.notOverSize(tfBenamning) && Validate.notOverSize(taBeskrivning)) {
int res = newKompetensdoman();
if (res == 1) {
PanelHelper.cle... | 4 |
public void flushEditor() {
Editor editor = getEditor();
VCNTreeItem item = editor.getTreeItem();
if (item != null && !item.isDisposed()) {
item.setContent(editor.getText());
}
} | 2 |
public boolean isAvailable() {
boolean reachable = false;
for (int i = 0; i < 10; i += 1) {
if (reachable) {
break;
}
Socket sock = new Socket();
int port = 139;
if (getType().equalsIgnoreCase("nfs")) {
port = 111;
}
try {
sock.connect(new InetSocketAddress(getIp(), port), 1000);
... | 5 |
public ListNode partition2(ListNode head, int x) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
ListNode preHead1 = new ListNode(x);
ListNode preHead = preHead1;
preHead.next = head;
ListNode p = head;
ListNode preP = preHead;
while (p != null) {
if (p.va... | 3 |
public void removeOnetimeLocals() {
StructuredBlock secondBlock = subBlocks[1];
if (secondBlock instanceof SequentialBlock)
secondBlock = ((SequentialBlock) secondBlock).subBlocks[0];
if (subBlocks[0] instanceof InstructionBlock
&& secondBlock instanceof InstructionContainer) {
InstructionBlock first = ... | 7 |
private void move( Wallet dest, Wallet src, Yen moveAmount) {
final Yen preAmount = dest.getTotalAmount().add( src.getTotalAmount());
// FIXME: 投入金額からお金を崩して、moveAmountちょうどの金額ができるようにする
// 安いコインから順に移動させる
Deque<Coin> coins = Queues.newArrayDeque( //
Immutabl... | 4 |
public boolean equals(Object o)
{
if (!(o instanceof String))
{
return false;
}
String qText = (String) o;
return (questionText == qText);
} | 1 |
public Collection operands() {
final LinkedList v = new LinkedList();
final Iterator preds = cfg.preds(block).iterator();
while (preds.hasNext()) {
final Block pred = (Block) preds.next();
v.addFirst(operandAt(pred));
}
return v;
} | 1 |
public String getContentType(Request request) {
String type = URLConnection.guessContentTypeFromName(request.getURI());
if (type == null) {
type = "text/html";
}
return "Content-Type: " + type;
} | 1 |
private boolean hasVisitedNeighbours(Point p){
int c = 0;
if (this.maze[p.x - 1][p.y] == false) {c++;}
if (this.maze[p.x + 1][p.y] == false) {c++;}
if (this.maze[p.x][p.y - 1] == false) {c++;}
if (this.maze[p.x][p.y + 1] == false) {c++;}
return c > 1;
} | 4 |
public int compare(Event arg0, Event arg1) {
// the comparison is twofold: first, we sort based on the time when the event fires
// if the time is equal for two events, the event that was created earlier is defined
// to be smaller. (This approach guarantees a consistent ordering).
if(arg0.time == arg1.tim... | 4 |
public static void main(String[] args) {
/*
* Commandline invoer wordt verwerkt.
* De uitvoer wordt berekend door de functie som.
*/
int n = Integer.parseInt(args[0]);
if(n < 0 || n > 65535) {
System.out.println("Invoer getal is te groot of te klein voor dit programma");
} else {
int nsom = som(... | 2 |
private void deleteCommits() {
int size = commitsToDelete.size();
if (size > 0) {
// First decref all files that had been referred to by
// the now-deleted commits:
Throwable firstThrowable = null;
for(int i=0;i<size;i++) {
CommitPoint commit = commitsToDelete.get(i);
... | 9 |
private void close () {
if (handle == null)
return;
try {
handle.close();
socket.event_closed (endpoint, handle);
} catch (IOException e) {
ZError.exc (e);
socket.event_close_failed (endpoint, ZError.errno());
}
... | 2 |
@Override
public double arvo() throws IllegalStateException {
if (!super.laskettavatAsetettu() || super.getTakajasen().arvo() == 0) {
throw new IllegalStateException();
}
return super.getEtujasen().arvo() / super.getTakajasen().arvo();
} | 2 |
public void testLength1() {
Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(2) }));
Term zs = q5.oneSolution().get("Zs");
assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2... | 5 |
public void setName(String name) {
Name = name;
} | 0 |
void compute()
{
diagonals = new Diagonal( 0, this, 0 );
diagonals.p = new Path( 0, 0, PathOperation.nothing, 0 );
Diagonal current = diagonals;
best = diagonals;
d = 1;
int run = 0;
int N = (A.length>B.length)?A.length:B.length;
while ( d < N )
... | 8 |
public static void showFrame () {
/* 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://download.or... | 6 |
public double[] distributionForInstance(Instance instance) throws Exception {
double[] probs;
if (m_isLeaf && m_hasConstr) { //leaf
//leaf: use majoraty class or constructor model
probs = modelDistributionForInstance(instance);
} else {
if (m_isLeaf && !m_hasConstr)
{
p... | 7 |
public void EnvoyeTousClients(String message) {
synchronized (outputStreams) {
for (Enumeration<DataOutputStream> e = outputStreams.elements(); e
.hasMoreElements();) {
DataOutputStream outStream = (DataOutputStream) e.nextElement();
try {
outStream.writeUTF(message);
} catch (IOException ioe... | 2 |
public void printAuswertungPDF() {
if (table.getSelectedRowCount() == 0)
return;
List<EinzelWettkampf> lewk = new Vector<EinzelWettkampf>();
List<MannschaftsWettkampf> lmwk = new Vector<MannschaftsWettkampf>();
for (int i : table.getSelectedRows()) {
Wettkampf w = (Wettkampf) table.getValueAt(i, -1);
i... | 8 |
public void setMenos(TMenos node)
{
if(this._menos_ != null)
{
this._menos_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... | 3 |
public void atualizarWidgets(ImagemDeTabuleiro estado) {
int valor = 0;
int colunaLimite;
boolean simboloDaVez;
simboloDaVez = atorJogador.informarSimboloDaVez();
if(simboloDaVez){
daVez.setIcon(azulPreenchida);
} else {
daVez.setIcon(marromPreenchida);
}
for (int linha = 0; ... | 9 |
private void areaSolve()
{
Log.log("AreaSolve <Start>");
collectAreas(false);
for (Area area : mAreas)
{
if (area.isToRemove()) continue;
if (area.isEmpty())
{
openTiles(area.getTiles());
mChanged = true;
}
else if (area.isFull())
{
markTiles(area.getTiles());
mChanged = true;... | 4 |
public void run(){
int clientCount = -1;
while(true){
Iterator<ServerThread> it = connections.iterator();
while(it.hasNext()){
ServerThread conn = it.next();
if(!conn.isAlive()){
it.remove();
continue;
... | 6 |
public ExtDecimal sqrt(int scale) {
if (type == Type.NUMBER) {
if (this.compareTo(ExtDecimal.ZERO) >= 0) {
double dblval = this.doubleValue();
double dblguess = Math.sqrt(dblval);
//ExtDecimal factor = ExtDecimal.valueOf(1 / (2 * dblguess));
... | 7 |
public static void forceRepaintAndInvalidate() {
for (AppWindow window : AppWindow.getAllWindows()) {
window.invalidate(window.getRootPane());
}
} | 1 |
public void updatePages() throws InvalidMenuException{
int totalPages = pages.size();
List<Page> sorted = new ArrayList<Page>();
for(int i = 0; i < totalPages; i++){
sorted.add(Page.NULL_PAGE);
}
boolean[] missing = new boolean[totalPages];
for(int i = 0; i < missing.length; i++){
missing[i] = true;
... | 5 |
private boolean grabWavBlock () {
// Decide how to handle the WAV data
// 16 bit LE
if ((audioInputStream.getFormat().isBigEndian()==false)&&(audioInputStream.getFormat().getSampleSizeInBits()==16)) {
return grabWavBlock16LE (audioInputStream);
}
// 8 bit LE
else if ((audioInputStream.getFor... | 4 |
public StopWords(String file1,String file2)
{
try {
reader=new BufferedReader(new InputStreamReader(new FileInputStream(new File(file1))));
writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(file2))));
list=new ArrayList<String>();
} catch (FileNotFoundException e) {
e.print... | 1 |
@Override
public State transition(TransitionContext context)
{
if(context.isEof())
{
context.startToken();
context.emit(Kind.EOF);
return this;
}
if(context.isDigit())
{
context.startToken();
context.pushChar();
return NumberState.instance();
}
if(context.isWhitespace())
{
return... | 7 |
public void turnRight(double degrees)
{
if(crawlOff)
heading = heading - degrees;
else
{
double interval = 5.0;
if(degrees < 0)
interval = -interval;
double temp = heading - degrees;
while(Math.abs(heading - temp... | 3 |
public static int maxSequence(Rack r, int rack_size, int drawn, boolean forceBetter){
//Replace the drawn card with each value in rack
int prev_score = r.getLUSLength();
int max_pos = 0, max_score = 0;
for (int i=0; i<rack_size; i++){
int swapped = r.swap(drawn, i);
int temp_score = r.getLUSLength();
i... | 5 |
public static void main(String[] args) throws InterruptedException {
Thread.currentThread().setName("Startup");
GWCAConnection gwcaConnection = null;
try {
LOG.info("The \"Java GWCAConstants\" (version {}) is starting", Version.getVersion());
addShutdownHook();
... | 2 |
public void grille(){
for(int y = 0; y<env.taille_envi;y++){
for(int x = 0; x<env.taille_envi;x++){
if(env.grille[x][y]!=null){
Graphics g = agent[x][y].getGraphics();
if(((Bonhomme)env.grille[x][y]).type)
g.setColor(Color.RED);
else
g.setColor(Color.GREEN... | 4 |
public boolean insert(PageId pageNo, int frameNo) {
// Instantiate a new entry
BufHTEntry entry = new BufHTEntry();
// Set entry properties
// NOTE: this should be part of the constructor or through a setter method
entry.pageNo.pid = pageNo.pid;
entry.frameNo = frameNo;
... | 0 |
public Double calculateActivation(Double input) {
if (!objectIsSetUp)
throw new InvalidParameterException(
"No Setup method has been called! You need to call a Setup Method to set the Objects Properties.");
switch(myAlgorithm){
case Logistic: return Logistic(input);
case BoundedIdentity: return Saturate... | 5 |
public void act()
{
if (!direction)
{
redShadow.mirrorHorizontally();
}
redShadow = new GreenfootImage("Ninja//ninjaAbilityR//redShadow.png");
if (direction)
{
setRotation(30);
}
else
{
setRotation(150);
... | 4 |
@Override
public void update(Observable o, Object arg) {
if(o instanceof Interes)
{
System.out.println("Nuevo Interes: "+((Interes)o).getInteres());
}
//arg creo que contiene el valor que cambio
} | 1 |
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.