text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Integer getIdObservacion() {
return idObservacion;
} | 0 |
public String printAST()
{
StringBuilder ret = new StringBuilder();
switch(rhs.size()){
case 1:
if(rhs.get(0) instanceof DeclList){
ret.append(((DeclList)rhs.get(0)).printAST());
}else{
ret.append(((FuncList)rhs.get(0)).printAST());
}
break;
case 2:
ret.append(((DeclList)rhs.get(0)).prin... | 3 |
@Override
public Item next() {
if (!hasNext())
throw new java.util.NoSuchElementException();
Item x = current.item;
current = current.next;
return x;
} | 1 |
@SuppressWarnings("unchecked")
private Collection<Object[]> getParameterArrays4_3() throws Exception {
Object[][] methodCalls = new Object[][]{new Object[]{"getTestClass"}};
Class<?> cl = invokeMethodChain(this, methodCalls);
Method[] methods = cl.getMethods();
Method parametersMeth... | 5 |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
if (plugin.config.BLOCK_WATER_DESTROY_LIST.contains(event.getBlockClicked().getType())){
event.setCancelled(true);
} else if (plugin.frozenPlayers.conta... | 4 |
public static String clean(String s) {
String ns = "";
for (int i=0;i<s.length();i++) {
char c = s.charAt(i);
if (c>=47&&c<=57 || c==45 || c==43 || c==42 || c==95) {
ns += c;
}
}
return ns;
} | 7 |
public double getDouble(String key) throws JSONException {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number)object).doubleValue()
: Double.parseDouble((String)object);
} catch (Exception e) {
throw new JSONExc... | 2 |
public String toString(){
return color ? "o":"x";
} | 1 |
void updateFramebufferSize() {
// Useful shortcuts.
int fbWidth = rfb.framebufferWidth;
int fbHeight = rfb.framebufferHeight;
// Calculate scaling factor for auto scaling.
if (maxWidth > 0 && maxHeight > 0) {
int f1 = maxWidth * 100 / fbWidth;
int f2 = maxHeight * 100 / fbHeight;
scalingFactor = Ma... | 9 |
@Override
public boolean equals(Object o) {
if ( !this.getClass().equals(o.getClass()) ) {
return false;
}
Key other = (Key)o;
if ( this.key == other.key ) {
return true;
} else {
return false;
... | 2 |
public SubjectVo detail(int no) throws Throwable {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = dataSource.getConnection();
stmt = con.prepareStatement(
"select SNO, TITLE, DEST from SE_SUBJS"
+ " where SNO=?");
stmt.setInt(1, no);
rs = stmt.exec... | 5 |
private String getDeleteVerified( String variable ) {
StringBuilder sb = new StringBuilder();
if ( variable.equalsIgnoreCase( table.getDomName() ) ) {
sb.append( "\n" + TAB + TAB + TAB + "readRecord = " + toJavaCase( variable ) + "Dao.read( ");
sb.append( param + " );\n" );
... | 1 |
public static void main(String[] args) {
RockPaperScissors myRPSgame = new RockPaperScissors();
String choice;
boolean keepOnPlaying=false;
if(args.length==0){
keepOnPlaying=true;
System.out.println("Play a game? Choose an option:");
}
Scanner in = new Scanner(System.in);
do{
choice="";
if(ar... | 8 |
private List<Mapper> estimateMappers() {
List<Mapper> newMapperList = new ArrayList<Mapper>();
if(isSplitSizeChanged || isMapperConfChanged) {
MapperEstimator mapperEstimator = new MapperEstimator(finishedConf, newConf);
//split size is changed
if(isSplitSizeChanged) {
List<Long> splitsSi... | 9 |
private TreeNodePageWrapper getNodeOfPage (TreeNodePageWrapper parentNode, AbstractPage page) {
TreeNodePageWrapper childNode = null;
for (@SuppressWarnings("unchecked")
Enumeration<TreeNodePageWrapper> children = parentNode.children(); children.hasMoreElements();) {
childNode = children.nextElement();
if (... | 2 |
private void writeComment() {
if ( comment == null ) {
sb.append( "" );
}
else
sb.append( comment );
} | 1 |
@Test
public void validateBudgetObjectAndThrowExceptionIfNull() {
try {
calculateBudgetBreakdown.calculateBreakdown(null, budgetBreakdown);
fail("Budget Object Is Null.");
} catch(Exception e) {
assertEquals("Budget is null.", e.getMessage());
}
} | 1 |
@Override
public Iterable<Key> keys()
{
LinkedList<Key> list = new LinkedList<Key>();
for (int i = 0; i < M; i++)
if (keys[i] != null)
list.add(keys[i]);
return list;
} | 2 |
@Override
public void use(Mob source, World world) {
int dir = source.dir;
Vector2i pos = Vector2d.toVector2i(source.getPos());
Vector2i targeted;
//TODO: fix this shit.
if (dir == Mob.dirUp) {
targeted = new Vector2i(pos.getX() >> 4, (pos.getY() >> 4) - 1);
... | 6 |
private static boolean deleteDirectory(File path)
{
if (path.exists())
{
File[] files = path.listFiles();
for (int i = 0; i < files.length; i++)
if (files[i].isDirectory())
deleteDirectory(files[i]);
else
... | 3 |
@Override
public Buildable create(Object name, Object value) {
if (name.equals("forecast_end")) {
Date d = Conversions.convert(value, Date.class);
fc_end = new GregorianCalendar();
fc_end.setTime(d);
} else if (name.equals("forecast_days")) {
fc = (Int... | 5 |
static int FMInitTable() {
int s, t;
double rate;
int i, j;
double pom;
/* allocate total level table plus+minus section */
TL_TABLE = new int[2 * TL_MAX];
/* make total level table */
for (t = 0; t < TL_MAX; t++) {
if (t >= PG_CUT_OFF) {
... | 8 |
public void stopOpenCmsProcess(String targetDirectory) {
// Check to see if a process is specified in the pid.txt file
this.getLogger().info(
"Checking to see if OpenCms Process is currently running");
try {
String currentlyRunningPid = this.readPidFromFile(targetDirectory);
if (!StringUtils.isEmpty(... | 5 |
private StringBuilder constructOutputsInit()
{
StringBuilder outputsInit = new StringBuilder();
HashSet<String> outputVars = new HashSet<String>();
outputsInit.append("\t/* Initialize output variables*/\n");
for(int i = 0; i < states.length; i++)
for(int j = 0; j < states[i].length; j++)
{
S... | 8 |
public void moveMatchedFiles(){
File folderToMove = new File(folderForTheRestOfRaw);
for(String name:filesNamesFromFolderWithJPG){
if(fileAndItsNameinRawFolder.containsKey(name)){
try {
Files.move(fileAndItsNameinRawFolder.get(name).toPath(),
folderToMove.toPath().resolve(fileAndItsNameinRawFolde... | 3 |
private void collectSaveables(Component component, List<Saveable> saveables) {
if (component instanceof Container) {
Container container = (Container) component;
int count = container.getComponentCount();
for (int i = 0; i < count; i++) {
collectSaveables(container.getComponent(i), saveables);
}
}
... | 3 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int score = Integer.parseInt(in.next());
if (score > 85) {
System.out.println("A");
} else if (score > 75) {
System.out.println("B");
} else if (score > 65) {
System.out.println("C");
} else if (score > 55) {
System.out.println("D"... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Computer))
return false;
Computer other = (Computer) obj;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
ret... | 9 |
public Texture(String fileName) {
try {
BufferedImage image = ImageIO.read(new File(TEXTURE_FOLDER + fileName));
int[] flippedPixels = image.getRGB(0, 0, image.getWidth(), image.getHeight(), null, 0, image.getWidth());
int[] pixels = new int[flippedPixels.length];
// Flip the image vertically
for(i... | 6 |
public static int toggleDoor(){
int i, j, k;
int count = 0;
boolean s2, s;
Map<Integer, Boolean> map = new HashMap<Integer, Boolean>();
s = true;
for (k = 1; k <= 100; k++){
map.put(k, s); //save all NO. of doors and status in map
}
for (i = 2; i <= 100; i++){
for (j... | 6 |
public void writeCellWithComputationsToFilesForVisualization(
String fullFileName,
int maxMeas,
int minMeas,
int mcc,
int net,
int area,
long cellid,
int n,
double d,
double r) {
List<OpenCellIdCell> cells = parseCells(fullFileName, maxMeas, minMeas, r);
for(OpenCellIdCell cell : ... | 6 |
public static double[] getOptimalParams(int day,XYSeriesCollection dataset, String fileName, int lineNumber,double[] Prices) throws FileNotFoundException, IOException
{
double[] answer=new double[2];
int testStartDay=day-20;
double tempResult=0;
for(int longPeriod=10;longPeriod<80;l... | 9 |
public static void main(String args[]) {
try {
MulticastSocket ms = new MulticastSocket();
ms.setTimeToLive(1);
InetAddress ia = InetAddress.getByName("experiment.mcast.net");
while (true) {
int ch;
String s = new String();
do {
ch = System.in.read();
if (ch != '\n') {
s = s + ... | 4 |
@Override
public void removeClientDisconnectListener(DisconnectOnServerListener listener) {
if (clientDisconnectListenerList != null) {
clientDisconnectListenerList.remove(DisconnectOnServerListener.class, listener);
}
} | 1 |
public Direction getFacing() {
return (isMoving() || isCancelingMove() || isRecoveringFromCanceledMove() ? moveDirection : facingDirection);
} | 3 |
public int getXSquares() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getXSquares() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getXSquares() END");
}
return X_SQUARES;
} | 4 |
public boolean mapActionPath(Request request){
String actionPath = getActionpathListenPattern();
String regExpActionPath = actionPath;
String requestPath = request.getPath();
List<String> varNames = new ArrayList<String>();
List<String> varValue = new ArrayLis... | 5 |
public PointGame getDownNeighbor() {
int x0 = x;
int y0 = y;
while (y0 < MAXY) {
// check if x=3 and y=2, we cannot go down.
if (x0==3 && y0==2) {
break;
}
y0++;
if (Board.validPoints.contains(new PointGame(x0,y0))) {
return new PointGame(x0,y0);
}
}
return null;
} | 4 |
public void engineSetSeed(byte[] seed) {
// compute the total number of random bytes required to setup adaptee
int materialLength = 0;
materialLength += 16; // key material size
materialLength++; // index size
byte[] material = new byte[materialLength];
// use as much as possible by... | 6 |
public int getNumberOfImages()
{
return numberOfImages;
} | 0 |
private int update() {
int n = getWritableFieldsCount();
String fields = "";
String separator = "";
Object[] valuesObj = new Object[n];
int i =0;
String clause = "";
String delimiter = "";
for(BeanTableMapping mapping: tableFields)
... | 9 |
public static boolean deleteSystem(String name) {
if(listSystems.containsKey(name)) {
System system = listSystems.get(name);
if(system.getUnits().isEmpty()) {
listSystems.remove(name);
return true;
}
... | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... | 7 |
public static boolean checkMenuKeys(String keys)
{
for(byte j=0;j<ControlKeys.getKeys();++j)
{
if((keys.charAt(j) == '1' && !ControlKeys.isKeyPressed(j)) || (keys.charAt(j) == '0' && ControlKeys.isKeyPressed(j)))
return false;
}
return true;
} | 5 |
public void push(int action, IIntervalsTimeDomain domain) {
switch (action) {
case ADD:
actionStack.add(new AddAction(domain));
break;
case REMOVE:
actionStack.add(new RemoveAction(domain));
break;
case MASK:
... | 3 |
private static String replace(String original, String find, String replace) {
if (original == null) return original;
if (find == null) return original;
if (replace == null) replace = "";
int found = original.indexOf(find);
while (found != -1) {
original = original... | 4 |
@Override
public boolean equals( Object other )
{
if ( other instanceof Table )
{
Table t = (Table)other;
if ( t.versions.equals(versions)&&t.rows.size()==rows.size() )
{
for ( int i=0;i<rows.size();i++ )
{
R... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
JMenuItem it = (JMenuItem) e.getSource();
if (it.getText().equals("Quitter")) {
System.exit(0);
} else {
if (it.getText().equals("Pause") && _players != null) {
for (int i = 0; i < _players.length;... | 8 |
private void move(int x, int y) {
if(!selected) {
selectedColumn += x;
selectedRow += y;
selectedColumn = getColumnPosition(selectedColumn);
Column column = getColumn(selectedColumn);
selectedRow = column.getRowPosition(selectedRow);
} else {
Column column = getColumn(selectedColumn);
if(co... | 6 |
@Override
/**
* When attribute changed we need to change our LSDB and neighborList and
* and send to everyone a new LSP to keep them up to date.
*/
public void attrChanged(Interface iface, String attr) {
if (attr.equals("metric")) {
for (Entry<IPAddress, LinkState> ls : neighb... | 8 |
public void cycle(long n) {
for (long i = 1; i <= n; i++){
result = result * i;
}
System.out.println(result);
//return result;
} | 1 |
public static boolean createTradingStrategy(String name, String username,
ArrayList<String> ruleList) {
initialise();
UserAccount user = UserAccountController.returnAccount(username);
// Check rules are all valid
boolean validStrategy = validStrategy(name, ruleList);
// Check ts name is unique
boolea... | 8 |
public PongWindow() {
super();
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception ex) {
ex.printStackTrace();
}
this.width = 800;
this.height = 600;
if (ISMAXIMIZED) {
Dimension ... | 6 |
private static int biggestLength(ArrayList<String> string) {
int biggerLength = string.get(0).length();
for(int i = 1; i < string.size(); i++) {
if(string.get(i).length() > biggerLength) {
biggerLength = string.get(i).length();
}
}
return biggerLength;
} | 2 |
private boolean isPositionOutOfFrame(LifePosition lifePosition) {
return lifePosition.getPosition()[0] < 0 || lifePosition.getPosition()[1] < 0
|| lifePosition.getPosition()[0] >(frame.height()-1) || lifePosition.getPosition()[1] > (frame.width()-1);
} | 3 |
public int hashCode() {
return (username != null ? username.hashCode() : 0);
} | 1 |
@Override
public void run()
{
while (this.active)
{
try
{
if (players.isEmpty())
{
Thread.sleep(50L);
}
else
{
MapObjectPlayer p = players.pop();
... | 6 |
public Object execute(List<Object> args) {
if (args.isEmpty()) {
throw new IllegalStateException("at least one argument expected in function EQUALS");
}
else if (args.size() == 1) {
return true;
}
else {
Object prev = args.get(0);
... | 9 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (!(obj instanceof Version))
{
return false;
}
Versi... | 5 |
public CheckResultMessage check16(int day) {
int r1 = get(33, 5);
int c1 = get(34, 5);
int r2 = get(36, 5);
int c2 = get(37, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 +... | 5 |
public static void DoTurn(PlanetWars pw) {
// long endingTime = System.currentTimeMillis() + 5;
int testIndex = 0;
Planet source = null;
Planet dest = null;
MyNode root = new MyNode(new SimulatedPlanetWars(pw));
ArrayList<MyNode> beam = new ArrayList<MyNode>(3);
beam.add(root);
// for (MyNode node : r... | 8 |
@Override
public void run() {
//Thread.setPriority(4);
try {
BufferedReader in = new BufferedReader( new InputStreamReader( client.getInputStream() ));
String message = "";
while (message != null) {
message = in.readLine().trim();
//first we check for known commands, if nothing ma... | 9 |
private int ret10BitCode (int in,boolean errorBitsAllowed) {
int a,b,dif,errorMax;
// Make copy of what is going into the error corrector
unCorrectedInput=in;
if (errorBitsAllowed==true) errorMax=1;
else errorMax=0;
for (a=0;a<VALIDWORDS.length;a++){
dif=0;
for (b=0;b<BITVALUES.length;b++) {
if ((... | 5 |
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
}
catch (ClassCastException exc) {
System.err.println("The first argument to makeCompactGrid must use SpringLayo... | 7 |
protected void setI(int i)
{
tempI = i;
} | 0 |
public void testSimpleToken() throws Exception {
XmlPullParser xpp = factory.newPullParser();
assertEquals(true, xpp.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
// check setInput semantics
assertEquals(XmlPullParser.START_DOCUMENT, xpp.getEventType());
try {
... | 9 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final People other = (People) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {... | 5 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// Retrieving the form POST data
//int account_number = Integer.parseInt(request.getParameter("account_number"));
//int total_purchaseCost= Integer.pars... | 7 |
public void endOfTime() {
Iterator it = timeOut.keySet().iterator();
while(it.hasNext()) {
String nick = (String) it.next();
if(this.getDiffDate(nick) / 1000 >= timeToDeco) {
this.connectHandler.disconnect(nick);
timeOut.remove(nick);
}... | 2 |
private static DataSet[][][] aggregateTraces(String[] nodeClasses,
String[] approaches, String[] metrics) {
DataSet[][][] allData = new DataSet[nodeClasses.length][approaches.length][metrics.length];
for(int i = 0; i < nodeClasses.length; i++) {
// VirtuaTraces
... | 9 |
public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... | 4 |
private void process () {
IndexFile ixfl = null;
try {
File srcf = new File(srcPath);
if (!srcf.exists()) {
System.out.println ("File " + srcPath + " does not exist.");
return;
}
else if (srcf.isDirectory()) {
... | 8 |
private static final void loadImage(InputStream in, int length, String name, List<StdImage> images) throws IOException {
byte[] data = new byte[length];
StreamUtils.readFully(in, data);
StdImage img = StdImage.loadImage(data);
if (img != null) {
track(name, img);
images.add(img);
}
} | 1 |
public boolean commit() throws LoginException {
if (succeeded == false) {
return false;
} else {
// add a Principal (authenticated identity)
// to the Subject
// assume the user we authenticated is the SamplePrincipal
userPrincipal = new SamplePrincipal(username);
if (!subject.getPrincipals().con... | 4 |
public void writeWorld()
{
voted = false;
try {
// System.out.println("World sent s");
ByteBuffer toSend = ByteBuffer.allocate(9600004);
//out.write(Server.ENTIREWORLD);
//out.flush();
toSend.putInt(handle.earth.ground.w);
toSend... | 7 |
public void startRun(int numSteps)
{
if (numSteps == 0)
{
this.numSteps = 1;
infinite = true;
}
else
{
this.numSteps += numSteps;
}
try{
if (!threadRun && Thread.currentThread().isAlive())
{
new Thread(this).start();
}
}
... | 4 |
public boolean checkProjectileToShipCollisions(Projectile p, Ship s){
if(p.getPos().getX()>(s.getPos().getX()-(s.getSize().getWidth()/2)))
if(p.getPos().getX()<(s.getPos().getX()+(s.getSize().getWidth()/2)))
if(p.getPos().getY()>(s.getPos().getY()-(s.getSize().getHeight()/2)))
if(p.getP... | 4 |
public static synchronized ResponseParserFactory getInstance() {
if (instance == null) {
instance = new ResponseParserFactory();
}
return instance;
} | 1 |
public void fillDeclarables(Collection used) {
if (usedAnalyzers != null)
used.addAll(usedAnalyzers);
if (innerAnalyzers != null) {
Enumeration enum_ = innerAnalyzers.elements();
while (enum_.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enum_.nextElement();
if (classAna.getParent()... | 4 |
private double medianOfFive(ArrayList<double[]> puntos, int axis, int start){
if(puntos.get(start)[axis]>puntos.get(start+1)[axis])
swap(puntos, start,start+1);
if(puntos.get(start+2)[axis]>puntos.get(start+3)[axis])
swap(puntos,start+2,start+3);
//dejar en indice 0 el menor de los 4 (no es mediana)
... | 6 |
public String performSubtraction(String tal1, String tal2)
{
StringBuilder sBuilder = new StringBuilder();
int lenght = tal1.length();
tal2 = matchLenght(lenght, tal2);
int carry = 0;
int i = 0;
if(tal2.length() > lenght)
{
lenght = tal2.length();
tal1 = matchLenght(lenght, tal1);
}
// Rever... | 6 |
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... | 8 |
public double calcBuildingArea(double length, double width) {
if (length < 7 || length > 20) { // length value not within the accepted range?
return 0;
}
if (width < 5 || width > 15) { // width value not within the accepted range?
return 0;
}
double ar... | 4 |
private void initDirNames(File cfgFile) {
GenericObject cfg = EUGFileIO.load(cfgFile);
String mainDir = "";
String modDir = "";
if (cfg != null) {
mainDir = cfg.getString("maindir");
modDir = cfg.getString("moddir");
}
if(mainDir.equals("")) {
... | 4 |
public Move findbest(Game g) throws GameException {
try {
boolean max;
int bestVal;
// if first player, then find the max value
// otherwise find the min value
if (g.whoseTurn() == Game.FIRST_PLAYER) {
max = true;
bestVal = Integer.MIN_VALUE; // running max, starts at bottom
} else {
ma... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==this.b1)//write
{
l=new ArrayList<Exp>();
TextIO te=new TextIO();
te.readFile();
t1.setText(te.text);
for( String x : te.stringToArray()){
Exp ex=new Exp(x);
l.add(ex);
}
}
if(e.getSource()==this.b5)... | 8 |
public void train(List<DataEntry<double[], Integer>> data_set){
int m = data_set.size();
for(DataEntry<double[], Integer> entry:data_set){
phi[entry.label] += 1;
for(int i=0;i<N;i++){
mean[entry.label][i] += entry.data_vec[i];
}
}
for(int i=0;i<K;i++){
for(int j=0;j<N;j++){
mean[i][j] /= phi... | 6 |
private void knightTopRightPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 0 && y1 >= 0) && (x1 <= 5 && y1 <= 6))
{
if(board.getChessBoardSquare(x1+2, y1+1).getPiece().getPieceType() != board.getBlankPiece().getPieceType())
{... | 6 |
public boolean wearingHeldMetal(Environmental affected)
{
if(affected instanceof MOB)
{
final MOB M=(MOB)affected;
for(int i=0;i<M.numItems();i++)
{
final Item I=M.getItem(i);
if((I!=null)
&&(I.container()==null)
&&(CMLib.flags().isMetal(I))
&&(!I.amWearingAt(Wearable.IN_INVENTORY))
... | 8 |
public String getResult_HTML(){
if(endtime==null) evaluateBenchmark();
String s ="";
//if(totaltime==0) return "0ms ???";
if(sections.size()==0) return "keine sections angegeben";
else {
s="<html><table style='width:330px;' cellspacing='2' cellpadding='0'><tr><th>section name</th><th>ms</th><th>%</th>... | 3 |
public void setMerges(Merge merge, MapperCounters counters) {
long inputRecsInPreviousMerges = 0;
long outputRecsInPreviousMerges = 0;
List<MergeInfo> list = merge.getMergeInfoList();
MergeInfo info = null;
for(int i = 0; i < list.size(); i++) {
info = list.get(i);
merges.add(new MergeAction(info));
... | 5 |
public static String getLongestCommonSubsequence(String str1, String str2)
{
int[][] sol = new int[str1.length()+1][str2.length()+1];
int max = -1;
for(int i = 1; i < str1.length() + 1; i++)
{
for(int j = 1; j < str2.length() + 1; j++)
{
if(str1.charAt(i-1) == str2.charAt(j-1))
{
sol[i][j] =... | 8 |
public Pie getPie() {
if (pb.isBaked()) {
return pb.getPie();
} else {
BuilderClient.addOutput("error - your pie is not ready yet");
return null;
}
} | 1 |
@Override
protected void handleMessage(String message) {
String[] parsed = message.split(":");
if(parsed[0].equals("collision")) {
if(parsed[1].equals(Projectile.ENT_NAME)) {
if(parsed[2].equals("no")) {
this.health--;
SpaceInvaders... | 4 |
private void setupCloseBehaviour(final Stage primaryStage) {
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
if (StateMachine.isSongModified()
|| StateMachine.isArrModified()) {
... | 6 |
public String getDate_depreciated_by() {
return date_depreciated_by;
} | 0 |
public ArrayList<String> getModuletitles() {
try{
openDatabase();
}catch(Exception e){}
String query = "SELECT name FROM t8005t2 .modules";
ArrayList<String> modules = new ArrayList<String>();
try {
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) ... | 4 |
@Test
public void testUpdateEditorsPick() {
Integer testISBN = 800;
Set<StockBook> books = new HashSet<StockBook>();
books.add(new ImmutableStockBook(testISBN, "Book Name", "Book Author",
(float) 100, 1, 0, 0, 0, false));
try {
storeManager.addBooks(books);
} catch (BookStoreException e) {
e.print... | 9 |
private void initReportWriter() {
// Create an output factory
final XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
// Create an XML stream writer
final File reportFile = new File(getOutputDirectory(), "report.xml");
try {
reportWriter = xmlof.createXMLStreamWriter(new FileWriter(reportFile));
... | 2 |
public boolean sameStops(RoutePath b) {
boolean same = true;
ListIterator aLi = mStops.listIterator();
ListIterator bLi = b.getStops().listIterator();
while (aLi.hasNext() && bLi.hasNext()) {
Stop aS = (Stop) aLi.next();
Stop bS = (Stop) bLi.next();
System.out.println(aS.getID() + " -> " + bS.getID()... | 7 |
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.