text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void createDropTypes(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
Button textButton = new Button(parent, SWT.CHECK);
textButton.setText("Text Transfer");
textButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.wi... | 5 |
protected String getAction(String xml) {
if (xml == null) return null;
Document document;
try {
document = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream(xml.getBytes()));
... | 8 |
public static int readFileToArray(int[] array, int array_len, String filename) throws IOException {
File file = new File(filename);
BufferedReader br = new BufferedReader(new FileReader(file));
String line = br.readLine();
int i = 0;
while (line != null && i<array_len) {
array[i] = Integer.parseInt(line.t... | 2 |
public void gradient(double x[], double g[]) {
double f,sq1,sq2,sq3,f1,f2,f3,f4,fac,c1,c2,s1,s2;
double theta,x1,x2,x3,x4;
double f1d1,f1d2,f1d3;
double f2d1,f2d2,f2d3;
double f3d1,f3d2,f3d3;
double thd1,thd2;
if (id_f_to_min == 0) {
g[1] = 2.0*x[1];
} else i... | 8 |
public void run() {
long fps = 0;
long frames = 0;
long updateTimer = 0;
long framesPerSecondTimer = 0;
long timestamp = 0;
long sleepTime = 0;
firstGame = true;
long t1=0;
while(true) {
System.out.print("");
if(menu) continue;
if(!initialized) {
if(!firstGame) {
re... | 9 |
void AppendTable() {
responseContent.append("<html>\n" +
"<head>\n" +
"<title></title>\n" +
"<body>\n" +
"<h3> Total requests number: " + controller.getCount() + "</h3>" +
"<h3> Number of the unique requests: " + controller.get... | 3 |
public void lookForUpdates() {
System.out.println("Searching for updates ....");
String cmds[] = checkForNewVersion();
if (cmds.length > 1) {
System.out.println("New version found : " + cmds[0]);
System.out.println("Downloading FabFileBot.jar ...");
String loadPath = settings.get("updateServer", defaultB... | 3 |
private void adminGeneral(){
userList = new JList();
userList.setBackground(Color.white);
updateuserList();
JScrollPane scroll= new JScrollPane(userList);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setViewportView(userList);
s... | 7 |
private Map<String, Object> getDefaultFileProperties() {
Map<String, Object> properties = new HashMap<String, Object>();
if (repositoryType == REP_TYPE_ALFRESCO) {
properties.put(PropertyIds.OBJECT_TYPE_ID,
"cmis:document,P:loc:readiness,P:notification:notified");
... | 2 |
private void makeBehaviorCache(CtMember.Cache cache) {
List list = getClassFile2().getMethods();
int n = list.size();
for (int i = 0; i < n; ++i) {
MethodInfo minfo = (MethodInfo)list.get(i);
if (minfo.isMethod()) {
CtMethod newMethod = new CtMethod(minfo,... | 2 |
public String searchImage(int rawId, int action) {
int Action=action/32;//0-3
int Direction=(action/4)%8;
int FrameId=action%4;
if(Action==0){
int newActionId=this.generateActionId(0, Direction, 1);
return image_table.get(this.processID(rawId)).get(newActionId);
}
if(Action==1){
return image_table.... | 6 |
public boolean inInterval(double value)
{
boolean returnValue = true;
if(boundLeft <= value && value <= boundRight)
{
if(isOpenedLeft && value == boundLeft)
returnValue = false;
if(isOpenedRight && value == boundRight)
returnValue = fal... | 6 |
@Override
public void deserialize(Buffer buf) {
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
worldY = buf.readShor... | 4 |
public void testWithField3() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
try {
test.withField(DateTimeFieldType.dayOfMonth(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public void testPropertySetMonthOfYear() {
DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0);
DateTime copy = test.monthOfYear().setCopy(12);
assertEquals("2004-06-09T00:00:00.000+01:00", test.toString());
assertEquals("2004-12-09T00:00:00.000Z", copy.toString());
tes... | 2 |
public String getMatch() {return match;} | 0 |
private JPanel createIconDialogBox() {
JButton showItButton = null;
final int numButtons = 6;
JRadioButton[] radioButtons = new JRadioButton[numButtons];
final ButtonGroup group = new ButtonGroup();
final String plainCommand = "plain";
final String infoCommand = "info";
final String questionCommand = "q... | 7 |
public static String doubleToString(double d) {
if(Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if(string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
string.indexOf('E') < 0) {
while... | 7 |
void setExampleWidgetState () {
super.setExampleWidgetState ();
if (!instance.startup) {
setWidgetMinimum ();
setWidgetMaximum ();
setWidgetSelection ();
}
Widget [] widgets = getExampleWidgets ();
if (widgets.length != 0) {
if (orientationButtons) {
horizontalButton.setSelection ((widgets [0]... | 3 |
private boolean userIsStillAbleToWin(Card userCard) {
if (cardStack.size() > 0) {
return true;
}
int userCardValue = userCard.getValue();
int cardValue;
int diff;
for (int i = 0; i < NUMBER_OF_ROWS; i++) {
for (int j = 0; j < NUMBER_OF_COLS; j++) {
if (cards[i][j] != null) {
cardValue = car... | 6 |
public String needlessReplacement(String s){
List<Character> list = new ArrayList<Character>();
for(int i=0; i<s.length(); i++){
if(s.charAt(i) == ' '){
list.add('%');
list.add('2');
list.add('0');
}
else{
list.add(s.charAt(i));
}... | 3 |
public static void main(String args) {
/* Если аргументы отсутствуют, порт принимает значение поумолчанию */
int port = 20143;
/* Создаем серверный сокет на полученном порту */
ServerSocket serverSocket = null;
try { serverSocket = new ServerSocket(port);
Service.WriteLog... | 6 |
public static String ccase(String str)//for capitalized each word(title)
{
mystr="";
boolean status=true;
for(int k=0;k<str.length();k++)
{
my=str.charAt(k)+"";
if(status==true)
mystr=mystr+my.toUpperCase();
else
mystr=mystr+my.toLowerCase();
if(str.charAt(k)==32 || str.charAt(k)==9 || str.charAt(k... | 5 |
public void loadSupplier(){
supplierDataAccessor dataAccessObject=new supplierDataAccessor();
List<supplier> supList=new ArrayList();
DefaultTableModel patientDataTable=new DefaultTableModel();
Object[ ] columnNames=new Object[5];
Object[ ] fieldValues=new Object[5];
... | 3 |
private void openWebPage(String urlName) {
try {
URL u = new URL(urlName);
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE))
desktop.browse(u.toURI());
} catch (IOException e) {
e.printStackTrace();
} ca... | 5 |
public static int partition (int[] array, int start, int end) {
int pValue = array[start];
while (start < end) {
while (start < end && array[end] >= pValue) {
end--;
}
array[start] = array[end];
while (start < end && array[start] <= pValue) {
start++;
}
array[end] = array[start];
}
... | 5 |
public void actionPerformed(ActionEvent event)
{
Date now = new Date();
System.out.println("At the tone, the time is " + now);
Toolkit.getDefaultToolkit().beep();
} | 0 |
@Override
@SuppressWarnings("UnnecessaryReturnStatement")
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
switch (evt.getPropertyName()) {
case "value": {
throw new PropertyVetoException("cannot set value directly", evt);
}
case "components": {
... | 7 |
@Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
EdgeBetEtt e;
while(edgeIt.hasNext()){
e = (EdgeBetEtt) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx();
}
}
d... | 2 |
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 |
String getDrawType() {
switch (drawType) {
case Mesh.DRAW_MULTIPLE:
return "multiple";
case Mesh.DRAW_ARROW:
return "arrow";
case Mesh.DRAW_CIRCLE:
return "circle";
case Mesh.DRAW_CURVE:
return "curve";
case Mesh.DRAW_POINT:
return "point";
case Mesh.DRAW_LINE:
return "line";
case Mesh... | 8 |
private double influenceConverter(int magnitude)
{
double convertedMagnitude;
if (magnitude == Relationship.HIGH)
convertedMagnitude = 1.0;
else if (magnitude == Relationship.MEDIUM)
convertedMagnitude = 0.5;
else if (magnitude == Relationship.LOW)
... | 3 |
@Override
public void drawSprite(SpriteSheet sheet, int index, double startX,
double startY, double endX, double endY, double transparency,
boolean flipX, boolean flipY, Color color) {
double texMinX = ((double) sheet.getStartX(index) / ((double) sheet
.getSheet().getWidth()));
double texMinY = ((double)... | 2 |
public boolean UnlockAll(int xid) {
// if any parameter is invalid, then return false
if (xid < 0) {
return false;
}
TrxnObj trxnQueryObj = new TrxnObj(xid, "", -1); // Only used in elements() call below.
synchronized (this.lockTable) {
Vector vect = t... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResponseMessage other = (ResponseMessage) obj;
if (_correlationId == null) {
if (other._correlationId != null)
return false;
} else if (... | 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 void left(float a) {
for (float i = 0; i < a; i++) {
if (!this.touchRobotRotate()) {
this.rotateRobot(-1);
if (this.checkTouchBullet()) {
this.onHitByBullet();
return;
}
... | 4 |
@Override
public boolean deleteChild(Condition<?> n) {
if (!(n instanceof BinaryBooleanOperator)) {
return false;
}
if (children.get(0).equals(n))//left
{
children.set(0, ((Condition<?>) (n.randomChild())));
} else if (children.get(1).equals(n))//right... | 6 |
public Problem validate(final Object instance,
final AllowOnly annotation, final Object target,
final CharSequence value)
{
if (value == null || value.length() < 1)
{
if (annotation.required())
{
return new Problem(instance, annotation, target, value);
}
return null;
}
/*
... | 7 |
public void afficher(){
for(int elem : tabMarq){ // On affiche d'abord les biens placés
if(elem == 1)
System.out.print("☻");
}
for(int elem : tabMarq){ // On affiche les mal placés
if(elem == 2)
System.out.print("☺");
}
... | 4 |
private void enableMetrics() {
if(config.getBoolean("Metrics.enabled")) {
try {
console.sendMessage(pre + "§aMetrics starting!");
new Metrics(this).start();
console.sendMessage(pre + "§aMetrics started!");
}
catch(IOException e) {
console.sendMessage(pre + "§cMetrics did not start!");
}
... | 2 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
} | 0 |
@Override
public void doCommand() {
// if the player can afford the update of the tower we do nothing
if (tower.getOwner().getBank().getMoney() < tower.getUpgradePrice()) {
System.out.println("The player is too poor to update the tower !");
return;
}
if (tower instanceof GunTower) {
System.out.p... | 4 |
protected AlberoBin<T> cercaNodo(T x) {
if (coll == null) return null;
AlberoBin<T> curr = coll;
while (!curr.val().equals(x)) {
if (curr.val().compareTo(x) < 0) {
if (curr.des() == null) return curr;
curr = curr.des();
} else {
if (curr.sin() == null) return curr;
curr = curr.sin();
}
... | 5 |
public void set(EmpresaBean oEmpresaBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.initTrans();
if (oEmpresaBean.getId() == 0) {
oEmpresaBean.setId(oMysql.insertOne("empresa"));
}
UsuarioDao oUsuarioDao = new ... | 2 |
@Override
public void run(int interfaceId, int componentId) {
switch (stage) {
case -1:
stage = 0;
sendEntityDialogue(Dialogue.SEND_1_TEXT_CHAT,
new String[] { player.getDisplayName(),
"Hello, Ozan. I'm new here. Please guide me?" },
IS_PLAYER, player.getIndex(), 9827);
break;
case 0:
... | 6 |
static String bestimmeRichtung(Item kuchen, String richtigeRichtung,
String[] moeglicheRichtungen)
{
if(kuchen == Item.UKuchen || kuchen == Item.IKuchen)
{
return richtigeRichtung;
}
if(kuchen == Item.UGiftkuchen || kuchen == Item.IGiftkuchen)
{
List<String> richtungen = new ArrayList<String>(
... | 5 |
public static String promptStaffStatus(){
Scanner myKey = new Scanner(System.in);
String status = null;
boolean successful = false;
do{
System.out.println("What is the status of this StaffMember?\nPress 1 Permanent\nPress 2 for Temporary\nPress 3 Other\n");
int userEntryStatus = myKey.nextInt();
switc... | 4 |
@Override
public void destroy() {
myProcess.destroy();
} | 0 |
public void AddStartMenuElement() {
if (elementStart != null)
return;
elementStart = APXUtils.addResource("start_" + scrUniq, scrName,
scrTooltip, scrHotkey, scrIcon, APXUtils.scriptRootNew,
new MenuElemetUseListener(new String(filename)) {
@Override
public void use(int button) {
if (info... | 2 |
public boolean saveUpdateSubProcess() {
try {
String subProcessName = txtSubProcessName.getText();
int minTime = Integer.parseInt(txtMinTime.getText());
int idealTime = Integer.parseInt(txtIdealTime.getText());
int maxTime = Integer.parseInt(txtMaxTime.getText());
if (subProcess == null) {
subProc... | 3 |
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void bucketEmpty(PlayerBucketEmptyEvent pbee) {
Material bucket = pbee.getBucket();
if (Material.LAVA_BUCKET == bucket) {
Block block = pbee.getBlockClicked();
BlockFace face = pbee.getBlockFace();
... | 4 |
public int newUTF8(final String value) {
key.set(UTF8, value, null, null);
Item result = get(key);
if (result == null) {
pool.putByte(UTF8).putUTF8(value);
result = new Item(index++, key);
put(result);
}
return result.index;
} | 1 |
public String formatCriteria(){
String formattedCriteria;
switch(operand){
case RIGHTLIKE:
formattedCriteria = "`" + field + "` like '" + value + "%' " ;
break;
case LEFTLIKE:
formattedCriteria = "`" + field + "` like '... | 5 |
private void readParameterAnnotations(int v, final String desc,
final char[] buf, final boolean visible, final MethodVisitor mv) {
int i;
int n = b[v++] & 0xFF;
// workaround for a bug in javac (javac compiler generates a parameter
// annotation array whose size is equal to the number of parameters in
// t... | 4 |
private void numberStart() {
startTokenPos = pos;
while (pos < numRead) {
if (isDelimiter(buf[pos])) {
break;
}
pos++;
}
if (pos < numRead) {
// push the number
stack.push(Float.parseFloat(new String(buf, startTo... | 3 |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onExplode(final EntityExplodeEvent event) {
final Location loc = event.getLocation();
if (Variables.prevent_block_damage) {
for (final Location location : locations) {
if (location.getX() =... | 6 |
private synchronized void winner (String v) throws JMSException {
QueueConnection qc =null;
QueueSession qs =null;
///prova mess
try {
qc = qcf.createQueueConnection();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
qs = qc.createQueue... | 3 |
public static void main(String[] args) {
for(int i=0; i<10; i++){
if(i==2 || i==4){
System.out.println("Now i = " + i);
}else{
System.out.println("Value of i : " + i);
}
}
for(int i=10; i>=0; i--){
if(i!=0){
System.out.println("i is NOT equal to 0, value of i : " + i);
}else{
Sys... | 9 |
public Symbol parse() throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up direct ref... | 7 |
final boolean method733(int i, int i_11_, int i_12_, int i_13_) {
int i_14_;
int i_15_;
int i_16_;
if (!aBoolean1223) {
i_14_ = anInt1225 - i;
i_15_ = anInt1216 - i_11_;
i_16_ = anInt1229 - i_12_;
((Class72) this).anInt1232
= (int) Math.sqrt((double) (i_14_ * i_14_ + i_15_ * i_15_
+ i... | 8 |
public void setBorderStyle(Side side, Border style)
{
switch (side)
{
case TOP:
topBorder = new Border(style);
break;
case LEFT:
leftBorder = new Border(style);
break;
case BOTTOM:
bot... | 4 |
public void clearInformations()
{
for (Iterator<String> e = informations.iterator(); e.hasNext();) {
data.setUse((String) e.next(), false);
}
informations.clear();
notifyZElement();
} | 1 |
@Override
public boolean equals(Object ob)
{
if(ob instanceof Genotipo) {
Genotipo g = (Genotipo)ob;
if(g.numGenes!=this.numGenes) {
return false;
}
for(int i=0; i<this.numGenes; i++) {
if(this.getGen(i)!=g.getGen(i)) {
... | 4 |
@Override
public void mousePressed(MouseEvent event) {
if (!this.mainGUI.isDraggingFiguresEnabled()) {
return;
}
int x = event.getPoint().x;
int y = event.getPoint().y;
for (int i = this.guiFigures.size()-1; i >= 0; i--) {
FigureGUI f... | 9 |
public void testPerms(CommandSender sender, String[] args) {
if (args.length == 1) {
sender.sendMessage(pre + red + "Must specify permission and player!");
return;
}
if (args.length == 2) {
if (sender.hasPermission(args[1])) {
sender.sendMess... | 6 |
private static void shortestRep(String line) {
String shortestRep = "";
int i = 1;
int length = line.length();
if(length == 0)
System.out.println("0");
else if(length == 1)
System.out.println("1");
else{
shortestRep += line.charAt(0);
while(i<length){
if(shortestRep.charAt(0) == line.charAt(... | 6 |
public SqliteWriter(String databaseName, String tableName) {
this.databaseName = databaseName;
this.tableName = tableName;
} | 0 |
private static final int getOpenBraceCount(RSyntaxDocument doc) {
int openCount = 0;
Element root = doc.getDefaultRootElement();
int lineCount = root.getElementCount();
for (int i=0; i<lineCount; i++) {
Token t = doc.getTokenListForLine(i);
while (t!=null && t.isPaintable()) {
if (t.type==Token... | 7 |
public void exibir(String num){
String res = null;
for(int i = 0; i < telefonesBR.size(); i++){
if( telefonesBR.get(i).equals(num)){
res = telefonesBR.get(i);
}
}
System.out.println("(55)"+res.substring(0, 4)+"-"+res.substring(4, 8));
} | 2 |
public void checkAllowedWay(){
for(int i = 0; i < currentNode.listOut.size() ; i++ ){
boolean inRoute;
int j = 0;
inRoute = false;
int currentNodeID = currentNode
.listOut
.get(i)
.getFinishGNode()
... | 6 |
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
int var8 = var3.getBlockId(var4, var5, var6);
int var9 = var3.getBlockId(var4, var5 + 1, var6);
if((var7 == 0 || var9 != 0 || var8 != Block.grass.blockID) && var8 != Block.dirt.blockID) {
... | 5 |
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
programmerThread.stop();
lastPane = programmerFrame;
hidePanels(lastPane);
}//GEN-LAST:event_jButton10ActionPerformed | 0 |
public static Method getAsMethodOfPublicBase(Class c, Method m){
for(Class iface : c.getInterfaces())
{
for(Method im : iface.getMethods())
{
if(im.getName().equals(m.getName())
&& Arrays.equals(m.getParameterTypes(), im.getParameterTypes()))
{
return im;
}
}
}
Class sc = c.getSupercl... | 9 |
public void validateFile() throws FileNotFoundException, IOException, InvalidPropertiesFormatException
{
String extension = fileForValidationPath.substring(fileForValidationPath.lastIndexOf(".") + 1);
if(!extension.equals(ALLOWED_EXTENSION))
throw new FileSystemException("Invalid file extension\n"
+ "Onl... | 4 |
static void ProcessWorkload(String filename, WeightedGraph g){
String t = null;
int blocked = 0;
float time = 0;
int passed = 0;
int total = 0;
int totalHoc = 0;
int totalprob = 0;
try{
FileInputStream tempfile = new FileInputStream(filename);
DataInputStre... | 8 |
public void setPersonDeletionPercentage(double perCent){
this.personDeletionPercentage = perCent;
this.personDeletionPercentageSet = true;
if(this.itemDeletionPercentageSet && this.replacementOptionSet){
this.allNoResponseOptionsSet = true;
if(this.dataEntered){
... | 3 |
public static String recognizeConfiguration(String cfgPath) {
for(String t : registeredGameTypes.keySet()) {
try{
Game g = getGameFactory(t).buildGame(cfgPath);
if(g.validate() && !g.usesInternalBoard()) {
return t;
}
}catch(Exception ex) {}
}
return null;
} | 4 |
public static void main(String[] args) {
//declaração de variáveis
int i, j, k, rep = 0, temp, tamA = 10, tamB = 6, tamC = 16;
int[] listaA = {2, -5, -121, 102, -35, -2, 0, -125, 802, -10},
listaB = {6, 99, -1, 12, 102, -2}, listaC = new int[tamC];
//unir os arrays
... | 9 |
@Override
protected void done() {
try {
model = (MarketTableModel) get();
jTableMarketPrice.setModel(model);
sorter = new TableRowSorter<>(model);
jTableMarketPrice.setRowSorter(sorter);
TableColumnModel columnModel = jT... | 9 |
public void putRawFile(File file) throws InterruptedException {
queue.put(file);
LOG.info(StringUtil.concatenateStrings(
"A new entity was successfully added to Raw Entity Store. Total size of store now is - ", new Integer(
queue.size()).toString()));
// LOG.info("Failed to put a new entity to the Raw E... | 0 |
public SearchResponse(String request, WordIndex wordIndex) {
this.request = request;
this.wordIndex = wordIndex;
try {
tryCreateAmbits();
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
private GamePiece alphaBetaDestroy(GameBoard board, Team other){
GamePiece destroy = null; //piece to destroy
Team cloneOther = new Team(other);
ArrayList<GamePiece> canBeDestroyed = board.getAllDestroyable(cloneOther);
for(GamePiece p : canBeDestroyed){
if (!board.setupMode) { //move phase
GameBo... | 9 |
public Object invoke(final Map<String, ?> context) throws EvalError {
final NameSpace nameSpace = new NameSpace(_interpreter.getClassManager(), "BeanshellExecutable");
nameSpace.setParent(_interpreter.getNameSpace());
final BshMethod method = new BshMethod(_method.getName(), _method.getReturnType(), _method.getPa... | 7 |
public void layoutContainer(Container parent) {
preferredLayoutSize(parent); // sets left, right
Component[] components = parent.getComponents();
Insets insets = parent.getInsets();
int xcenter = insets.left + left;
int y = insets.top;
for (int i = 0; i < components.length; i += 2... | 1 |
@Override
public List<Integer> delete(Criteria criteria, GenericDeleteQuery deleteGeneric, Connection conn) throws DaoQueryException {
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(DELETE_QUERY);
String queryStr = new QueryMapper() {
@Override
... | 1 |
public AlgorithmParametersType getAlgorithmParameters() {
return algorithmParameters;
} | 0 |
public void setGameboard(Gameboard gameboard)
{
Field[][] fields = gameboard.getFields();
if (DEBUG) {
System.out.println("\n---- turn " + turn++ +"--------");
printFields(fields);
}
//reset destination information, "direction" variable remembers the last state
distToDest = distToDestX = distToDest... | 8 |
public void pokemonExperience() {
expGain = experienceGain();
GameFile.pokemonExp[0] = GameFile.pokemonExp[0] + expGain;
while (GameFile.pokemonExp[0] >= expReq) {
GameFile.pokemonLevels[0] = GameFile.pokemonLevels[0] + 1;
}
} | 1 |
public int tryHit(Coordinate c) {
// Ensure coordinates are within grid
if (c.x < 0 || c.y < 0 || c.x >= 10 || c.y >= 10) {
return -1; // Invalid coordinates
}
// Ensure board hasn't been shot at these coordinates
if (boardHits[c.x][c.y] == null) {
// Ite... | 9 |
protected void extract_pvalue_list(ArrayList<String> argv) {
ArrayList<Double> pvalues_tmp = new ArrayList<Double>();
try {
while (!argv.isEmpty()) {
pvalues_tmp.add(Double.valueOf(argv.get(0)));
argv.remove(0);
}
} catch (NumberFormatException e) {
}
if (IOExtensions.h... | 5 |
public int[] kmeans(double[] data, double dataMin, double dataMax, int max_itr) {//kϖ@Bef[^_ŏɑNX^̃CfbNXlƂĎzԂB
int size = data.length;
int[] cluster = new int[size];
//NX^S
double[] centers = new double[clusterMax];
for (int k=0; k<clusterMax; k++) {
centers[k] = dataMin + (dataMax - dataMin)*Math.rando... | 9 |
public static void sort3(int x) throws FileNotFoundException, IOException {
RandomAccessFile a = new RandomAccessFile("C:/Users/Tom/Documents/Code/Java/Ticks/1B/tick 0/test-suite/test"+x+"a.dat","rw");
RandomAccessFile a2 = new RandomAccessFile("C:/Users/Tom/Documents/Code/Java/Ticks/1B/tick 0/test-suite/test"+x+"a... | 9 |
public static void writePCData(StringBuffer buf, String text) {
buf.append(escapeXMLText(text));
} | 0 |
public static String Md5(String plainText) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
for (int offset = 0; offset < b.le... | 4 |
private void moveChicken() {
if (model.getChicken().isMoveRight()) {
//Is the user attempting to move the chicken outside the right boundary?
if (model.getChicken().getLocation().x >= Constants.FRAME_WIDTH - view.getChickenImage().getWidth(null)) {
model.getChicken().setMoveRight(false);
return;
}
... | 7 |
public Integer call() throws InterruptedException {
int sum = 0;
for (int i = 0; i < 100000; i++) {
sum += i;
}
System.out.println(numberOfThread);
return numberOfThread;
} | 1 |
public static void unregisterDirectory(File directory) {
if ((pathToWatchKey.containsKey(directory.toPath()) && !pathToWatchKey.containsKey(directory.getParentFile().toPath())) || !directory.exists()) {
// stop watching this directory
WatchKey key = pathToWatchKey.get(directory.toPath())... | 5 |
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 static void displayProgress(Graphics g, GameController gc, ImageLoader il, int x, int y, int progress, String displayText) {
int xPos, yPos;
int progressWidth;
BufferedImage bi;
x = x - (PROGRESS_CONTAINER_WIDTH / 2);
y = y + PROGRESS_CONTAINER_HEIGHT;
... | 6 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.