text stringlengths 14 410k | label int32 0 9 |
|---|---|
private boolean restPost(String restRequest, String[] pName, String[] pValue) {
String result = "";
String value = "";
if (pName != null && pValue != null && ! pName[0].isEmpty()) {
for (int i=0; i < pName.length; i++) {
value += "&" + pName[i] + "=" + pValue[i];
}
value = value.substring(1);
}
t... | 7 |
protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("SWITCH_COLOR".equals(PROPERTY)) {
background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");
} else if... | 7 |
protected void popFilters(String op, Filterable... queries) {
FilterGroup group = new FilterGroup().op(op);
for(Filterable q : queries) {
List<Filter> list = getFilterList(q);
if (list != null)
if (!list.isEmpty())
group.add(list.remove(list.size()-1));
}
add(group);
} | 3 |
public Integer getId() {
return id;
} | 0 |
public String getParameterString(){
String retString = super.getParameterString();
try{
if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString... | 6 |
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == cancel)
{
setVisible(false);
dispose();
}
else if (e.getSource() == submitClose)
{
if (submitClose.getText().equals(SUBMIT) && oneSelected())
{
enableButtons(false);
... | 5 |
public static void StopFillTask() {
if (fillTask != null && fillTask.valid())
fillTask.cancel();
} | 2 |
public void setPcaIdElemento(Integer pcaIdElemento) {
this.pcaIdElemento = pcaIdElemento;
} | 0 |
public void refresh(){
g2d[0].setColor(Color.BLACK);g2d[0].fillRect(0,0,width*20+height*20,width*15+height*15);
for (int h = 0 ;h<2;h++)
for (int j = 0 ;j<height;j++){
for (int i = 0 ;i<width;i++){
if (field[h][i][j] != null && field[h][i][j] != "") g2d[h].drawImage(Cursor.getTile(field[h][i][j]),convert.px(n... | 5 |
private int getDaysInMonth(int month, int year) {
int[] days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int days = days_in_month[month];
if (month == 1 && year % 4 == 0) {
if (year % 100 == 0) {
if (year % 400 == 0) {
days += 1;
... | 4 |
public static void main(String[] args) {
int players = 5;
int pound = 10;
ScoreBoard sb = new ScoreBoard(players);
Lane lane = new Lane();
Bowl bowl = new Bowl(pound);
for (int currentFrame = 1; currentFrame < RunBowling.FRAMES-1; currentFrame++) {
for (int currentPlayer = 0; currentPlayer < players; ... | 4 |
@Override
public void render (float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
countdown.update(delta);
if(countdown.isDone()){
Objects.playScreen.finished((int)chunk.x, (int)chunk.y);
ld.setScreen(Objects.playScreen);
}
camera.update();
Objects.BATCH.setProjectionMatrix(camera.combined);
... | 1 |
public void inverseSelection() {
expandMenu();
for(int i = 0; i < methodTree.getRowCount(); i++) {
TreePath path = methodTree.getPathForRow(i);
if(path == null) return;
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) path.getLastPathComponent();
... | 4 |
public static int min3(int a, int b, int c) {
if (a < b) {
return (a < c) ? a : c;
}
return (b < c) ? b : c;
} | 3 |
public List<QuestionInfo> getAnnotatedData(String corpusPath,
final String prefix, final String ext, final String chunkExt)
throws Exception {
if (corpusPath == null) {
throw new Exception("Corpus path is missing");
}
List<QuestionInfo> trainingData = new ArrayList<QuestionInfo>();
File folder = new Fi... | 9 |
public TestHolder(final char commandChar, final String args, final String fileName, final int lineNumber) {
super();
String commandString = new String(new char[] {commandChar});
if (commandChar == '<')
command = Command.SOURCE;
else if (commandChar == '=')
command = Command.SET;
else try {
command = ... | 3 |
private static Rectangle minimumCropRect(Vector<BufferedImage> spriteSet)
{
Rectangle cropRect = null;
for (BufferedImage sprite : spriteSet) {
Rectangle frameCropRect = determineCropRect(sprite);
if (cropRect == null) {
cropRect = frameCropRect;
... | 3 |
private void findAds(File video, IMediator mediator) {
System.out.println("Processing started");
int granularity = 5, numberOfContinuousSections = 8, calibrationIntervalLength = 40;
double maxElevation = 1.5;
long videoLength = VideoUtils.getVideoDurationInSeconds(video);
manage... | 1 |
synchronized public static int nextID() {
return globalID++;
} | 0 |
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g.setColor(DEF_BACKGROUND_COLOUR);
g.fillRect(0, 0, Util.IMAGE_SIZE, Util.IMAGE_SIZE); //clear the screen to remove artifacts
if(image != null) { // if there is an image to draw, draw it
for(int row = 0;row<Util.IMAGE_SIZE... | 5 |
public ArrayList<ArrayList<String>> partition(String s) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<ArrayList<String>> resArr = new ArrayList<ArrayList<String>>();
int n = s.length();
if (n == 0)
return resArr;
boolean[][] res = new boolean[n][n];
for (int i = 0... | 8 |
public String getPropertiesFilePath() {
return propertiesFilePath;
} | 0 |
public static int posteY(int rangee,int orientation){
int centreY = centrePositionY(rangee) ;
switch(orientation){
case Orientation.NORD :
centreY -= 20 ;
break ;
case Orientation.EST :
centreY -= 25 ;
break ;
case Orientation.SUD :
break ;
case Orientation.OUEST :
centreY -= 25 ... | 4 |
@Override
public void doing(Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
// String count = request.getParameter("count");
// int max = 1;
// if (count != null && !count.equals(""))
// max = Integer.valueOf(count);
JSONArray lstJSON = new JSONArray();
... | 5 |
public boolean shouldExtract(String path) {
if (this.exclude != null) {
for (String rule : this.exclude) {
if (path.startsWith(rule)) return false;
}
}
return true;
} | 3 |
public void start()
{
// variables: g = generation, n = population size, ff = fitness function
Generation g = this.getGeneration();
int n = g.getPopulationSize();
SpiderBotFitnessFunction ff = new SpiderBotFitnessFunction();
// main loop
do
{
// determine the generation number
int gen_count = g.g... | 9 |
public String toString() {
if(this.image.trim().equals(":~")) { //weak constraint
ASTbody body=(ASTbody) this.jjtGetChild(0);
if(this.jjtGetNumChildren()>1) {
ASTconstraintParams params =(ASTconstraintParams) this.jjtGetChild(1);
return ":~"+body.toString()+". "+params.toString();
}
else {
ret... | 8 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Jump other = (Jump) obj;
if (captureX != other.captureX) {
return false;
}
if (captureY != other.captureY) {... | 9 |
public PlayerListener getPlayerListener() {
return playerListener;
} | 0 |
@Override
public void setData(Object data) {
this.data = data;
} | 0 |
private int getDirection(double x, double y) {
if (y < 0 && x < 0) {
return (int) (180 + Math.toDegrees(Math.atan(Math.abs(y) / Math.abs(x))));
}
if (y < 0 && x > 0) {
return (int) (360-Math.toDegrees(Math.atan(Math.abs(y) / Math.abs(x))));
}
if (y > 0 && ... | 8 |
public CheckResultMessage check5(int day) {
int r = get(17, 5);
int c = get(18, 5);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != (getValue(r + day, c, 4).compareTo(getValue(r + day
- 1, c + 5, 4)))) {
return er... | 5 |
protected void encodeElements(mxCodec enc, Object obj, Node node)
{
if (obj.getClass().isArray())
{
Object[] tmp = (Object[]) obj;
for (int i = 0; i < tmp.length; i++)
{
encodeValue(enc, obj, null, tmp[i], node);
}
}
else if (obj instanceof Map)
{
Iterator<Map.Entry> it = ((Map) obj).entr... | 8 |
private void checkForMessages() throws IOException {
while (!messageQueue.isEmpty()) {
Message message = messageQueue.poll();
for (SocketChannel channel : acceptedConnections) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out =... | 3 |
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 printLines(int indent, String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
printRegion(indent + startPos, line);
pw.print(line.substring(endPos));
}
} | 1 |
private void propogateState() {
MultiType source = mergeSource;
while (source != null) {
source.interfaces = interfaces;
source.potentialClass = potentialClass;
source = source.mergeSource;
}
} | 1 |
public void nextPermutation(int[] num) {
int i,j,k,notde,firstlar,temp;
int len=num.length;
if(len==1) return;
for(i=len-1;i>0;i--)
{
if(num[i-1]<num[i])
break;
}
notde=i-1;
if(num[0]>=num[1])
{
for(j=0;len-... | 8 |
@Override
public Object stringToValue(String text) throws ParseException {
return new Double(Math.min(Math.max(Numbers.getLocalizedDouble(text, mMinValue <= 0 && mMaxValue >= 0 ? 0 : mMinValue), mMinValue), mMaxValue));
} | 2 |
public void specificRequest() {
// 具体的功能处理
System.out.println("this is in Adaptee!");
} | 0 |
protected void fillShape(DrawableItem di, Graphics2D g) {
g.setColor(di.getFill());
g.fill(di.getShape());
} | 0 |
public boolean isAdd() {
return myAdd;
} | 0 |
private static void clearArea(CellState[][] states, int x, int y, Location gLoc){
Grid<Actor> gr = GridWorldLife.instance.world.getGrid();
for(int r = 0; r < states.length; r++){
for(int c = 0; c < states[0].length; c++){
int row = gLoc.getRow() + (r - y);
int col = gLoc.getCol() + (c - x);
... | 4 |
public synchronized void updateDisplay()
{
// check that x and y are at least 0
if (xPos < 0)
xPos = 0;
if (yPos < 0)
yPos = 0;
// if picture
if (picture != null)
{
if (xPos >= picture.getWidth())
xPos = picture.getWidth() - 1;
if (yPos >= picture.getHeight... | 8 |
public void run() {
while (true) {
TACMessage msg = getMessage();
boolean sent;
for (int errors = 0; !(sent = sendMsg(msg)) && errors < 3; errors++) {
log.warning("failed to send message " + msg.getType()
+ " (retry " + (errors + 1) + ')');
try {
Thread.sleep(1000);
} catch (Exception ... | 5 |
public static void main(String[] args) {
List<Rider> riders = new ArrayList<Rider>();
// Rider rider = new Rider(name, raceCode) ??? what is race code
riders.add(new Rider("Human", Rider.HUMAN_CODE));
riders.add(new Rider("Hobbit", Rider.HOBBIT_CODE));
riders.add(new Rider("bu... | 6 |
public void translateAll() {
for (DrawableItem pa : l.getDrawable()) {
if (pa instanceof Panel && !((Panel) pa).deleted) {
Point p = getPanelAnchor((Panel) pa);
double hfactor = -(p.x - (((double) variables.THUMBNAIL_WIDTH * p.x) / (double) variables.CANVAS_WIDTH));
... | 5 |
private double calculateRisk(Vector pos) {
double risk = 100.0 / pos.distanceSq(getTargetPosition());
for(double[] edge : State.wavelessField.getEdges()) {
risk += 5.0 / (1.0 + Line2D.ptSegDistSq(edge[0], edge[1], edge[2], edge[3], pos.x, pos.y));
}
/*
* Get points between enemy location and corner an... | 3 |
private static final void speedCheck(final List<LifeMovementFragment> res, final MapleClient c) {
double speedMod, playerSpeedMod = c.getPlayer().getStat().getSpeedMod() + 0.005;
for (LifeMovementFragment lmf : res) {
if (lmf.getClass() == AbsoluteLifeMovement.class) {
final ... | 5 |
@Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/entrada/list.jsp");
try {
EntradaDao oEntradaDao = new EntradaDao(oContexto.getE... | 3 |
public void touch(Entity e, Level level)
{
if (e instanceof CoinEntity)
{
CoinEntity ce = ((CoinEntity) e);
if (!ce.collected)
{
score++;
Sound.coin.play();
ce.collected = true;
}
}
} | 2 |
public static ArrayList<Interval> insert(ArrayList<Interval> intervals,
Interval newInterval) {
ArrayList<Interval> result = new ArrayList<Interval>();
// loop intervals
for (Interval interval : intervals) {
if (interval.end < newInterval.start) {
result.add(interval);
} else if (interval.start > ne... | 5 |
public static ModelClassDesc getClassDesc(TableDesc tableDesc,
String packageName) {
return MySQLUtils.tableParseToMode(tableDesc);
} | 0 |
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
ArrayList<Character> list = new ArrayList<>();
ArrayList<Character> combinedList = new ArrayList<>();
// read chars from first list;
// with "replaceAll" method remove a... | 4 |
@Override
protected boolean xsend (Msg msg_, int flags_)
{
// If this is the first part of the message it's the ID of the
// peer to send the message to.
if (!more_out) {
assert (current_out == null);
// If we have malformed message (prefix with no subsequent ... | 9 |
private void secondRun() {
// compute the cumulative distribution function
double cdf[] = new double[maxIter + 1];
double t = 0;
int min = maxIter, max = 0;
for (int j = 0; j <= maxIter && active(); ++j) {
t += Math.pow((double)histogram[j].get... | 9 |
public FiltersMenu() {
super("Filter");
setEnabled(true);
JMenuItem gaussianFilter = new JMenuItem("Gaussian");
gaussianFilter.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
if (panel.... | 3 |
public List<ApiKey> apiKeys() throws EasyPostException {
ApiKeys parentKeys = ApiKeys.all();
if (this.getId() == parentKeys.getId()) {
return parentKeys.getKeys();
}
for(int i=0; i < parentKeys.children.size(); i++) {
if(this.getId().equals(parentKeys.children.get(i).getId())) ... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Npc other = (Npc) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
... | 3 |
@Override
public String value(int index) {
return index < value.length? value[index]:null;
} | 1 |
private void initComponents() {
setLayout(new GroupLayout());
add(getJLabel0(), new Constraints(new Leading(26, 10, 10), new Leading(55, 12, 12)));
add(getJLabel2(), new Constraints(new Leading(115, 10, 10), new Leading(17, 12, 12)));
add(getJButton0(), new Constraints(new Leading(66, 81, 10, 10), new Leading(2... | 0 |
public double[] rawPersonRanges(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawPersonRanges;
} | 2 |
public ConfigurationWriter() {} | 0 |
public void compute()
{
String tr = inpGtria.getText() ;
String[] trias = new String[4] ;
/* Read the trias configuration from inpGtria into trias[0..2], skipping lines
* that start with a hash mark.
*/
Scanner s = ... | 8 |
public byte[] genKey(int index, int permuted_index) {
int i, bit;
byte[] key = null;
assert (index < (1 << n_inputs)) : "gen_key: index >= 2^n_inputs (too big)";
MyUtil.md.reset();
MyUtil.md.update(MyUtil.toByteArray(gate_index));
MyUtil.md.update(MyUtil.toByteArray(pe... | 4 |
public boolean liveRangesIntersect(final VarExpr a, final VarExpr b) {
Assert.isTrue((a != null) && (b != null),
"Cannot get intersections for null def");
Assert.isTrue(a.isDef() && b.isDef(),
"Cannot get intersections for variable uses");
if (a == b) {
return false;
}
// If all locals should hav... | 5 |
static ImageIcon getKarelImage(int direction) {
switch (direction) {
case NORTH: {
if (nkarel == null)
nkarel = new ImageIcon(Display.class.getResource(nkarelLocation));
return nkarel;
}
case EAST: {
if (ekarel == null)
ekarel = new ImageIcon(Display.class.getResource(ekarelLocat... | 8 |
private boolean intersectVertical(KDPoint q, double distActual, boolean left) {
return q.getY() >= yi && q.getY() <= yf && Math.abs(q.getX() - (left ? xi : xf)) <= distActual;
} | 3 |
void expand(ArrayList<Integer> C,ArrayList<Integer> P){
if (timeLimit > 0 && System.currentTimeMillis() - cpuTime >= timeLimit) return;
nodes++;
for (int i=P.size()-1;i>=0;i--){
if (C.size() + P.size() <= maxSize) return;
int v = P.get(i);
C.add(v);
ArrayList<Integer> newP = new ArrayList<Integer... | 9 |
protected void writeJSON()throws JsonParseException, IOException
{
JsonFactory jsonF = new JsonFactory();
JsonParser jp = null;
JsonGenerator jg = null;
try
{
jp = jsonF.createJsonParser(is);
jg = jsonF.createJsonGenerator(os);
jg.useDefaultPrettyPrinter(); // enable indentation just to make deb... | 9 |
public static IList<Integer> divide(IList<Integer> ls) {
if (ls.length() <= 1) {
return ls;
}
IList<Integer> ll = new MLinkedList<>();
IList<Integer> lr = new MLinkedList<>();
int len = ls.length();
int pivotindex = len / 2;
INode<Integer> currNode = ls.getFirst();
while (currNode != null) {
i... | 3 |
public static String eliminarCerosString(String s){
String temp = s.trim();
if (esNumero(temp) && !temp.isEmpty()){
Integer i = Integer.parseInt(temp);
if (i != 0)
temp = i.toString();
else
temp = "";
}
return temp;
} | 3 |
public static void insertCommandeFournisseur( int idutilisateur, String referencefournisseur, Date datecommandefournisseur, Float remisefournisseur) throws SQLException {
String query = "";
try {
query = "INSERT INTO COMMANDE_FOURNISSEUR (ID_UTILISATEUR,COMFOUREF,COMFOUDATE,COMFOUREMISE) V... | 1 |
public String getMaxGain( TextProcessing TextPro ) {
double Entropy_S = getInformationEntroy(TextPro.objResult.Result_Count);
HashMap<String, Double> GainMap = new HashMap<String, Double>();
for ( int i = 0; i < TextPro.objAttributeList.size(); i ++ ) {
Attribute objAttr = TextPro.objAttributeList.get(i);
A... | 5 |
private void expand() {
if (nextRecord == null)
return;
//System.out.println("Pushing record starting at : " + nextRecord.getAlignmentStart());
records.push(new MappedRead(nextRecord));
//Find next suitable record
try {
nextRecord = recordIt.next();
}
catch(NoSuchElementException ex) {
next... | 6 |
public void click() {
Rectangle upArrow = new Rectangle(PotatoHead.CORNER_X + 400, PotatoHead.CORNER_Y + 0, 80, 40);
Rectangle downArrow = new Rectangle(PotatoHead.CORNER_X + 400, PotatoHead.CORNER_Y + 560, 80, 40);
if (upArrow.contains(Mouse.mse)) {
scrollUp();
} else if (d... | 6 |
private void closeResourceSilently(ResultSet res, PreparedStatement pstt,
Connection conn) {
if (res != null)
try {
res.close();
} catch (SQLException ignore) {
}
if (pstt != null)
try {
pstt.close();
} catch (SQLException ignore) {
}
if (conn != null)
try {
conn.close();
... | 6 |
private void initReference(){
File f = new File(PATH_RESSOURCE+REFERENCE_MORSE);
FileReader fr;
try {
fr = new FileReader(f);
BufferedReader b = new BufferedReader(fr);
int i = 0, j = 0;
int tmp = b.read();
while(tmp != -1){
if(tmp != 44 && tmp != 10){ //44 = ' ' et 10 = '\n'
reference[i][... | 6 |
public void setPixel(int color, int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height)
return;
pixels[x + y * width] = color;
} | 4 |
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
String value = new String(ch, start, length).trim();
if (lastFieldName != null) {
logger.info(String.format(Messages.getString("parsing_field"), //$NON-NLS-1$
lastFieldName, value));
if (currentParser.parseFie... | 2 |
public static void main(String[] args) throws Exception {
Thread t = new Thread(new Blocked2());
t.start();
TimeUnit.SECONDS.sleep(1);
System.out.println("Issuing t.interrupt()");
t.interrupt();
} | 0 |
public static void pascalTriangle(int n) {
int[][] pascal = new int[n+1][n+1];
for( int i = 0; i< n+1; i++) {
for( int j = 0; j< i; j++) {
if(i-1 >= 0 && j-1 >= 0) {
pascal[i][j] = pascal[i-1][j] + pascal[i-1][j-1];
} else {
... | 6 |
public static final long extractTime(String text) {
if (text != null) {
Matcher matcher = TIME_PATTERN.matcher(text);
if (matcher.find()) {
long time = TimeUnit.MILLISECONDS.convert(Numbers.extractInteger(matcher.group(1), 0, false), TimeUnit.HOURS);
time += TimeUnit.MILLISECONDS.convert(Numbers.extract... | 2 |
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... | 9 |
@Override
public void run() {
Gson convert = new Gson();
try {
// ----------------
// Login Protocol
// ----------------
ChatSocket = new DatagramSocket(Storage.getPort(),InetAddress.getByName("0.0.0.0"));
ChatSocket.setBroadcast(true);
// Get JSON Interpretation
String HELLO = convert.toJson... | 9 |
public void run() {
running = true;
final int CASH_PORT = 4713;
try {
ServerSocket cashServerSocket = new ServerSocket(CASH_PORT);
ServerDataBaseManager sDBM = new ServerDataBaseManager();
while (true) {
if (running) {
new CashServerExecutionThread(cashServerSocket.accept(), sDBM).start();
}... | 3 |
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 boolean matches(@NotNull String labelStr) {
for (Label exclude : excludes) {
if(exclude.getName().equals(labelStr)) {
return false;
}
}
if(includes.isEmpty()) {
return true; //We either have nothing or only excludes
}
for (Label include : includes) {
if(include.getName().equa... | 5 |
public static void main(String [] args) throws IOException, InterruptedException
{
init();
StringBuilder s = null;
while(true)
{
s = grabVal();
String temp = constructString(s);
write(temp);
Thread.sleep(1000000);
}
} | 1 |
private void processMultipart(Multipart multipart, PrintWriter printwriter)
throws Exception
{
boolean flag = true;
String s = "";
int i = 0;
for(int j = multipart.getCount(); i < j; i++)
{
BodyPart bodypart = multipart.getBodyPart(i);
String s... | 9 |
private static Drug getDrug(Drug bean, PreparedStatement stmt, ResultSet rs) throws SQLException{
if(bean.getDrugId()!=0)
stmt.setInt(1, bean.getDrugId());
else
stmt.setString(1, bean.getDrugName());
rs = stmt.executeQuery();
if (rs.next()) {
Drug newBean = new Drug();
newBean.setDrugId(rs.get... | 2 |
@Override
public void run(){
//trick so that _ONLY_ send() can run this method!
//only send() sets isStarted to true.
//if send() is called with true isStarted it'll throw an exception
//thus it's impossible to call this function more than once.
if (!isStarted) return;
isReady = false;
try{
//me... | 9 |
private void save() {
try {
RecordStore.deleteRecordStore(RECORDSTORE_SESSION); // Clear data
}
catch (Exception e) { /* Nothing to delete */ }
RecordStore rs = null;
ByteArrayOutputStream baos = null;
DataOutputStream dos = null;
try {
rs... | 9 |
int dataSize() throws UnsupportedEncodingException
{
if ( parent!=null || isHint() )
return 0;
else if ( data == null )
return 0;
else
return byteLength();
} | 3 |
public static void main(String[] args) throws NoSuchFileException, IllegalArgumentException {
if (args.length >= 5) {
Draft.checkHash( args[0] );
Draft.checkRange(args[1], 4, 15);
Draft.checkRange(args[2], 1, 50);
Draft.checkRange(args[3], 0., 1.);
for(int ... | 4 |
private boolean searchCombo(int x, int y, int type) {
int slot = y * 15 + x + 1;
for (int i = 0; i < 5; i++) {
if (piece[slot + i] == type) {
if (i == 4) {
return true;
}
} else {
break;
}
}
... | 7 |
public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
int var7 = var1.getBlockMetadata(var2, var3, var4);
if(var7 == 0) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
super.getCollidingBoundingBoxes(var1, var2, var... | 4 |
public void update()
{
int xa = 0, ya = 0;
counter++;
if(counter > 2)
{
if(game.xPlayer > x) xa++;
if(game.xPlayer < x) xa--;
if(game.yPlayer > y) ya++;
if(game.yPlayer < y) ya--;
counter = 0;
}
if(xa != 0 || ya != 0) {
move (xa, ya);
walking = true;
} else {
walking = false... | 8 |
public static void handleUnsubscribeReply(HTSMsg msg, HTSPClient client) {
Collection<String> requiredFields = Arrays.asList(new String[]{});
if (msg.keySet().containsAll(requiredFields)){
//TODO
} else if (msg.get("error") != null){
//TODO
} else{
System.out.println("Faulty reply");
}
} | 2 |
public void insert(int obj, int entry, int score)
{
try{
if (writeInvFile[entry]==null){
String newDirectory=indexDirectory+"/new";
File pl_f=new File(newDirectory+"/pl_e"+entry+".dat");
if(!pl_f.exists()){
File indexDirectory_f... | 5 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.