text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Coord xlate(Coord c, boolean in) {
if (in) {
return c.div(getScale());
} else {
return c.mul(getScale());
}
} | 1 |
public void setInt(int wert) {
setBits(false);
if (wert < 0)
return;
for (int i = 0; i < size; i++) {
if (wert == 0)
break;
if ((wert & 1) == 1)
bits[i] = true;
wert = wert >>> 1;
}
} | 4 |
public static void clOutputOneUnit(TranslationUnit unit, PrintableStringWriter stream) {
{ Stella_Object translation = unit.translation;
if (translation == null) {
System.out.println("`" + unit + "' has a NULL translation.");
return;
}
if (unit.category != null) {
if (!(Tr... | 7 |
public void setX(int x) {
this.x = x;
} | 0 |
public void mouseClicked(MouseEvent e) {
if (!onClickDown && e.getClickCount() == 2 && actionCommandDoubleClick != null) {
callActionListenersDouble();
}
} | 3 |
@Override
public boolean equals(Object obj) {
if (obj instanceof Coordinate) {
Coordinate otherCoord = (Coordinate)obj;
return this.row == otherCoord.row &&
this.col == otherCoord.col;
}
return false;
} | 2 |
private void initPanel() {
JPanel p = new JPanel();
p.setLayout(null);
for (int i=0;i<7;i++){
createLabel(p,i);
createTextField(p,i);
}
// Add confirm button
JButton confirmButton = new JButton("Confirm");
confirmButton.setBounds(WIDTH/4, 9*HEIGHT/11, WIDTH/2, HEIGHT/13);
confirmButton.addActionL... | 8 |
public void inserisci(T x) {
AlberoBin<T> padre = cercaNodo(x);
if (padre == null) {
// inserisco la radice
coll = new AlberoBinLF<T>();
coll.setVal(x);
} else if (!padre.val().equals(x)) {
AlberoBinLF<T> figlio = new AlberoBinLF<T>();
figlio.setVal(x);
if (x.compareTo(padre.val()) < 0) padre.se... | 3 |
private String getTextAsEps(String text) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
final char c = text.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c == '(') {
sb.append("\\(");
} else if (c == ')') {
sb.append("\\)");
} else if... | 9 |
private int getol(Coord tc) throws Loading {
int ol = map.getol(tc);
if (ol == -1)
throw (new Loading());
return (ol);
} | 1 |
public synchronized void threadStart(SimThread t) {
if (Constants.muCheck) {
if ((Constants.muIncS += Constants.muIncUp) <= .95) {
t.Constants._epsilon = this.epsilon;
t.Constants._SIM_epsilon_start = this.epsilon;
t.Constants._SIM_epsilon_final = this.epsilon;
t.setRunNum(runNum);
runNum++;
... | 5 |
public void openDoor() {
System.out.println("模板共性,打开车门");
} | 0 |
public static boolean skipClass(ClassInfo clazz) {
InnerClassInfo[] outers = clazz.getOuterClasses();
if (outers != null) {
if (outers[0].outer == null) {
return doAnonymous();
} else {
return doInner();
}
}
return false;
} | 2 |
public SubscribeEventModel buildFromXml(String xml) throws DocumentException {
if (null == xml || xml.trim().isEmpty()) return null;
List<Element> list = WechatUtils.getXmlRootElements(xml);
SubscribeEventModel subscribeModel = new SubscribeEventModel();
for (Element element : list) {
... | 7 |
private static boolean checkHwReqs(float wfHwCpu, float wfHwMem,float wfHwStorage, String archValue, QuerySolution qs)
{
//iapp HW specs (in MB)
float iappHwCpu = 0;
float iappHwMem = 0;
float iappHwStorage = 0;
String iappArch = "";
String hwcpu = qs.get("?hwcpu").toString();
String... | 9 |
public final boolean equals(Object o)
{
if (!(o instanceof Entry)) return false;
Entry e = (Entry)o;
Object k1 = Integer.valueOf(getKey());
Object k2 = Integer.valueOf(e.getKey());
if ((k1 == k2) || ((k1 != null) && (k1.equals(k2)))) {
Object v1 = getValue();
Object v2 ... | 7 |
@Test
public void test_saveArrayToFile() {
String filePath = "testFile.txt";
// creating list with specified amount of random numbers
List<Integer> list = appUtil.getRandomNumbers(10, 10);
appUtil.saveArrayToFile(filePath, list);
// testing existence of file
File f... | 1 |
public static int getMaxTimerFromScore(GameMode mode, int score)
{
if (mode == GameMode.CASUAL)
{
return 10000;
}
else
{
if (score < 100)
{
return 10000;
}
else if (score < 150)
{
return 7000;
}
else if (score < 200)
{
return 5000;
}
else if (score < 250)
{
... | 6 |
public void visitReturnExprStmt(final ReturnExprStmt stmt) {
if (stmt.expr == from) {
stmt.expr = (Expr) to;
((Expr) to).setParent(stmt);
} else {
stmt.visitChildren(this);
}
} | 1 |
public Piece makePiece(String s) {
boolean color = 'W' == s.charAt(0);
switch (s.charAt(1)) {
case 'X':
return new Blank(color);
case 'B':
return new Bishop(color);
case 'R':
return new Rook(color);
case 'P':
return new Pawn(color);
case 'Q':
return new Queen(color);
case 'K':
... | 7 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String ud = request.getParameter("u");
String rd = request.getParameter("r");
response.setContentType("text/html;charset=UTF-8");
t... | 2 |
@Override
public boolean onCommand(final CommandSender sender, final ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMes... | 8 |
public static int singleNumber(int[] A) {
HashMap<Integer, Integer> hashMap=new HashMap<>();
for(int i=0;i<A.length;i++){
if(!hashMap.containsKey(A[i]))
hashMap.put(A[i], 1);
else {
if(hashMap.get(A[i]) == 2)
hashMap.remove(A[i]);
else {
hashMap.put(A[i], hashMap.get(A[i])+1);
}
}... | 3 |
private static String join(final String[] args, final String delim) {
if (args == null || args.length == 0) return "";
final StringBuilder sb = new StringBuilder();
for (final String s : args) sb.append(s + delim);
sb.delete(sb.length() - delim.length(), sb.length());
return sb.... | 3 |
private String[] getClassPath() {
java.util.Vector x = new java.util.Vector();
String classPath = System.getProperty("java.class.path");
String s = "";
for (int i = 0; i < classPath.length(); i++) {
if (classPath.charAt(i) == ';') {
x.add(s);
s = "";
} e... | 4 |
public void pickUpAction(int index) throws InvalidActionException {
if (grid.getItemsOnPosition(grid.getElementPosition(getActivePlayer())).isEmpty())
throw new IllegalArgumentException("There is no item to be picked up on the current position!");
if (grid.getItemsOnPosition(grid.getElementPosition(getActivePlay... | 3 |
public void get_file() throws IOException {
// Source
//File f = new File("D://Alibaba//test.csv");
File f = new File("D://Alibaba//t_alibaba_data.csv");
InputStream is = new FileInputStream(f);
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(is));
String lineString = reade... | 4 |
@Override
public void addJob(State s, Job j) {
VM vm = null;
VMType type = null;
JobType jobType = j.getType();
double utilization = Double.MAX_VALUE;
// Find
for (Entry<VMType, UtilizationVector> e : jobType.utilizationVector.entrySet()) {
UtilizationVector v = e.getValue();
double u = v.CPU.avera... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void visitFieldInsn(
final int opcode,
final String owner,
final String name,
final String desc){
mv.visitFieldInsn(opcode, owner, name, desc);
if(constructor)
{
char c = desc.charAt(0);
boolean longOrDouble = c == 'J' || c == 'D';
switch(opcode)
{
case GETSTATIC:
pushValue(OTHER);
... | 9 |
@Override
public ILDAPRetrievalService buildService() throws LDAPServiceCreationException {
ILDAPRetrievalService service = null;
if (this.getLDAPResource().getServerVendor().equals(LDAPServiceProviderType.APACHEDS_SERVICE_PROVIDER.name())) {
try {
service = new org.sharpsw.ldap.services.apacheds.Retrieval... | 6 |
public static void traversal(TreeNode root, int sum) {
if (null == root) return;
if (null == root.left && null == root.right && sum == root.val) {
stack.add(root.val);
List<Integer> items = new ArrayList<Integer>();
for (Integer i : stack) {
items.add(i);
}
res.add(items);... | 5 |
public String stOpenBrowserInstance (int dataid,int expVal, String flow){
int actVal=1000;
String returnVal=null;
hm.clear();
hm=STFunctionLibrary.stMakeData(dataid, "Post");
String url = hm.get("URL");
String newwindowtitle = hm.get("NewWindowTitle");
try {
Block : {
... | 5 |
private void selectAnimalChange( Animal nouvelAnimal ) {
animalSelect = nouvelAnimal;
positions = animalSelect.getPositions();
positionsAff = animalSelect.getPositions();
nomAnimal = animalSelect.getNom();
afficherDonnees();
} | 0 |
public IntTreeBag()
{
this.root = null;
} | 0 |
private static String escape(String str) {
int len = str.length();
StringWriter writer = new StringWriter((int) (len * 0.1));
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
switch (c) {
case '"':
writer.write(""");
... | 7 |
public double Opera(char operando, String verificaPosicao, String [] guardaVariavel, double [] guardaValores, int linhasGuardaVariavel){
double result=0;
String aux2=verificaPosicao.substring(verificaPosicao.indexOf("=")+1, verificaPosicao.indexOf(operando));//variavel antes do token + - / * %
String aux3=ver... | 6 |
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Helpers.setMinTransfer(jTextField1.getText());
String assetID = "ALL";
if (assetList != null && assetList.size() > 0 && jComboBox6.getSelectedIndex() > -1) {
System.out.... | 3 |
public static void main(String args[]) {
try { //RXgN^IȂƂ͐ɂōsB
if (args.length >= 1) {
infroot = args[0];
if (args.length >= 2) {
clusterMax = Integer.parseInt(args[1]);
if (args.length >= 3) {
maxIter = Integer.parseInt(args[2]);
}
}
}
} catch (Exception e) {
System.out... | 9 |
public void connect() throws Exception {
URLConnection yc = website.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
... | 1 |
public void setShortMessageFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.shortMessageFontStyle = UIFontInits.SHORTMESSAGE.getStyle();
} else {
this.shortMessageFontStyle = fontstyle;
}
somethingChanged();
} | 1 |
public String stFacebookSharingVerification(int dataId,int ExpVal,String flow )
{
int actVal=1000;
String returnVal=null;
hm.clear();
hm=STFunctionLibrary.stMakeData(dataId, "Post");
String url = hm.get("URL");
String newwindowtitle = hm.get("NewWindowTitle");
String sharingtitle = hm.get("Sh... | 5 |
private ApiProfileImpl() throws ProfileExceptions {
String defaultPath = new File("").getAbsolutePath().toString()
+ BitMusicStructure;
if(!Files.exists(FileSystems.getDefault().getPath(defaultPath))) {
try {
Files.createDirectory(FileSystems.getDefault().getPath(defaul... | 4 |
public void getPermissoesRelatorios() {
item_relAtendimentoAnalitico.setVisible(permissoes.getRelAtendimentoAnalitico());
item_relAtendimentoSintetico.setVisible(permissoes.getRelAtendimentoSintetico());
item_relClienteByLink.setVisible(permissoes.getRelClientesByLink());
item_relCliente... | 6 |
public Complex log() {
double rpart = Math.sqrt(re * re + im * im);
double ipart = Math.atan2(im, re);
if(ipart > Math.PI) {
ipart = ipart - 2.0 * Math.PI;
}
return new Complex(Math.log(rpart), ipart);
} | 1 |
public void getMultiPart(Multipart content) {
try {
int multiPartCount = content.getCount();
for (int i = 0; i < multiPartCount; i++) {
BodyPart bodyPart = content.getBodyPart(i);
Object o;
o = bodyPart.getContent();
if (o instanceof String) {
maildata.append(o+"\n");
} else if (o in... | 5 |
private synchronized void sendTo(ClientThread client, ChatMessage message) { //envoyer un message à un destinataire en particulier (pour MPs et connexions)
message.setDest(client.username);
if (message.getSender().equals("null"))
message.setSender("Serveur");
message.setTimeStamp(simpleDate.format(new Date... | 7 |
int backward(int cur) {
_optimumEndIndex = cur;
int posMem = _optimum[cur].PosPrev;
int backMem = _optimum[cur].BackPrev;
do {
if (_optimum[cur].Prev1IsChar) {
_optimum[posMem].makeAsChar();
_optimum[posMem].PosPrev = posMem - 1;
... | 3 |
public void moveVisibleAreaToCoord(double xCoord, double yCoord)
{
visibleArea.setCoord(xCoord - (visibleArea.getxLength() / 2), yCoord - (visibleArea.getyLength() / 2), visibleArea.getxLength(), visibleArea.getyLength());
searchXCoord = getWidth() / 2;
searchYCoord = getHeight() / 2;
timer.purge();
timer.ca... | 1 |
public VentanaPrincipal(ListaTexto textoOriginal, ListaTexto textoNuevo) {
//iniciar Objetos
this.miTextoOriginal = textoOriginal;
this.miTextoNuevo = textoNuevo;
miMaestroControlador = new MaestroControlador(miTextoOriginal, miTextoNuevo);
//iniciar propiedades del frame
setDefaultCloseOperation(JFrame.... | 7 |
@Override
public List<StrasseDTO> findStreetsByStartPoint(Long startPunktId, boolean b) {
List<StrasseDTO> ret = new ArrayList<StrasseDTO>();
if(startPunktId ==1){
StrasseDTO s= new StrasseDTO();
s.setStartPunktId(Long.valueOf(1));
s.setEndPunktId(Long.valueOf(2));
s.setDistanz(Long.valueOf... | 5 |
void generateAddrModeClasses() throws IOException {
setPrinter(newInterfacePrinter("addr", hashMapImport, null,
tr("The <code>$addr</code> class represents an addressing mode for this architecture. An " +
"addressing mode fixes the number and type of operands, the syntax, and th... | 7 |
@Override
public double getTipValue() {
double tip = 0.00; // always initialize local variables
switch(serviceQuality) {
case GOOD:
tip = baseTipPerBag * bagCount * (1 + GOOD_RATE);
break;
case FAIR:
tip = baseTipPerBag * bagCo... | 3 |
public void windowActivated(WindowEvent e)
{
// TODO Auto-generated method stub
} | 0 |
public int getWidth() {
Window window = device.getFullScreenWindow();
if (window != null) {
return window.getWidth();
}
else {
return 0;
}
} | 1 |
public int remove(Long objId){
for(Town i: towns){
if(i.getId().equals(objId)){
towns.remove(i);
return 0;
}
}
for(Airport i: aports){
if(i.getAirportId().equals(objId)){
aports.remove(i);
... | 4 |
public final void setContext(String context, CLC contextController) {
if(contextMap.containsKey(context)) {
System.out.println("[CLC] Warning: There is already a context controller associated with the context "+ context);
}
contextMap.put(context, contextController);
} | 1 |
@Test
public void testCancelButtonAfterCalculated() throws Exception {
propertyChangeSupport.firePropertyChange(DialogWindowController.CALCULATED, 0, 1);
assertEquals(view.getButton().isEnabled(), false);
view.close();
assertEquals(view.getButton().isEnabled(), true);
} | 0 |
public void test_getDefault_checkRedundantSeparator() {
try {
PeriodFormat.getDefault().parsePeriod("2 days and 5 hours ");
fail("No exception was caught");
} catch (Exception e) {
assertEquals(IllegalArgumentException.class, e.getClass());
}
} | 1 |
private void writeJSON(Object value) throws JSONException {
if (JSONObject.NULL.equals(value)) {
write(zipNull, 3);
} else if (Boolean.FALSE.equals(value)) {
write(zipFalse, 3);
} else if (Boolean.TRUE.equals(value)) {
write(zipTrue, 3);
} else {
... | 8 |
private int getPlayerIndexInGame(String username,
List<PlayerDescription> players) {
int playerGameIndex = -1;
for (int i = 0; i < players.size(); i++) {
PlayerDescription pd = players.get(i);
if(pd.getName().equals(username)) {
playerGameIndex = i;
break;
}
}
return playerGameIndex;
} | 2 |
public Rule.Action getMatchedAction(Message message) {
for (Rule rule : this.rules) {
if (rule.isMatched(message)) {
return rule.getAction();
}
}
return null;
} | 2 |
@Override
public ArrayList<String> getGoToList() {
// TODO Auto-generated method stub
return null;
} | 0 |
private void inputBestValue(){
double ansd = 0;
String ans = null;
ans = (String)JOptionPane.showInputDialog(this, "Best Value", "Other", JOptionPane.PLAIN_MESSAGE,
null, null, String.valueOf(obj_sel.minC + (obj_sel.maxC - obj_sel.minC)/2));
//suggest the median value
tr... | 5 |
public AbstractMatrix(int m, int n) {
if (n <= 0 || m <= 0) {
try {
throw new Exception(
"The matrix has to have a size of at least 1 x 1.");
} catch (Exception e) {
e.printStackTrace();
}
}
this.m = m;
this.n = n;
} | 3 |
public DataModel<PacienteBean> listaPacientes() {
PacienteDAO paciente = new PacienteDAO();
if (paciente.getPacientes() != null) {
pacientesBean.removeAll(pacientesBean);
for (PacienteDAO p : paciente.getPacientes()) {
pacientesBean.add(new PacienteBean(p.getId(),... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProcedureCallNode other = (ProcedureCallNode) obj;
if (actualParameters == null) {
... | 9 |
private String getText() throws ParsingException
{
Characters c = lastEvent.asCharacters();
// Ignore empty content
if (!c.isWhiteSpace())
{
return c.toString();
}
else
{
return "";
}
} | 1 |
public AlarmCreater(MainFrame parent){
this.parent = parent;
try {
aal = new Alarm_AccessLink();
} catch (IOException ex) {
JOptionPane.showMessageDialog(parent, "An sql error has occured: " + ex.getMessage());
}
initComponents();
txtTime.setValue(... | 5 |
@Override
public void handle(HttpExchange he) throws IOException {
String method = he.getRequestMethod().toUpperCase();
response = "";
status = 0;
switch (method) {
case "GET":
getRequest(he);
break;
case "POST":
... | 4 |
public void mousePressed(MouseEvent e) {
if((e.isControlDown())&&(e.getButton()==BUTTON1))
{
markerRect=new MarkerRect(MapGetter.getLatitude(e.getY()),MapGetter.getLongtitude(e.getX()));
//MainView.createPoint(MapGetter.getLongtitude(e.getX()), MapGetter.getLatitude(e... | 2 |
@Test
public void testAwaitAsyncExecutionSuccess() {
SyncProcess proc = TestUtil.executionSuccessSyncProcess();
IProcessComponent<Void> busyComp = new BusyComponent(TestUtil.executionSuccessComponent(true));
IProcessComponent<?> asyncComp = new AsyncComponent<Void>(busyComp);
proc.add(asyncComp);
try ... | 3 |
private void registerButtonActionPerformed() {
ArrayList<ScheduleDTO> schedule = saleTrainsTableModel.getTrains();
request.setService(Constants.ClientService.buyTicket);
int row = saleTrainsTable.getSelectedRow();
if (row == -1) {
JOptionPane.showMessageDialog(null, "Не вы... | 8 |
public static JSONArray freeGPIOs() {
JSONArray freeList = new JSONArray();
DTO dtoCreator = new DTO();
String pinmuxFile = "/sys/kernel/debug/pinctrl/"+baseOffset+".pinmux/pinmux-pins";
try {
BufferedReader pinmux = new BufferedReader(new FileReader(pinmuxFile));
// get rid of the first two lines
S... | 6 |
public static Image load(File imageFile) {
Image input = new Image(Display.getCurrent(),
imageFile.getAbsolutePath());
// go check if we have to rotate it
Image result = null;
try {
Metadata metaData = ImageMetadataReader.readMetadata(imageFile);
if (metaData.containsDirectory(ExifIFD0Directory.class... | 8 |
public void decode( ByteBuffer socketBuffer ) {
if( !socketBuffer.hasRemaining() || flushandclosestate )
return;
if( DEBUG )
System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(... | 8 |
public void actionPerformed(ActionEvent e){
if(e.getSource() == connectbutton){
try {
connect();
indicator.setText("Connecting...");
indicator.setForeground(Color.blue);
} catch (IOException e1) {
}
}else if(e.getSource() == sendbutton){
//Show Status
indicator.setText("Encrypting");
... | 6 |
public void testGoodAnswerGameToBeLost() {
System.out.println("Test 2 : gameToBeLost");
Game gameToBeLost = new Game(new GameMaster(
DefaultValues.DEFAULTATTEMPTCOMBINATION1), new Board());
Answer answer;
// 1. Wrong combinations input. number : Board.SIZE.
for (int i = 0; i < Board.SIZE -... | 1 |
public String get_username(int id) {
if(users == null) return "";
List listusers = users.getChildren();
if (listusers != null){
Iterator i = listusers.iterator();
while(i.hasNext()){
Element current = (Element)i.next();
int currid = Integer.parseInt(current.getAttributeValue("id")... | 4 |
ArrayList<Schedule> fitnessCalc(ArrayList<Schedule> schedule){
ArrayList<Schedule> scheduleFit = new ArrayList<>();
Schedule chromoSchedule;
//for(int i=0; i)
for(int a=0; a<schedule.size(); a++){
chromoSchedule = schedule.get(a);
RoomScheme roomA = chromoSc... | 1 |
public static void removeFromTable(int index) throws NullPointerException {
if (tableData!=null){
int datalength = tableData.length -1;
Object[][] temp = new Object[datalength][5];
total -= (Integer) (tableData[index][2])
* (Integer) (tableData[index][3]);
Item tempitem=new Item();
tempitem.setId((Integ... | 5 |
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
try {
String username = usernameTextField.getText();
String password = passwordTextField.getText();
if (password.equals("") || username.equals("")) {
... | 4 |
private int binaryToDecimal(String binaryNumber){
int len = binaryNumber.length(),sum =0,c=0;
int e = 0;
int multiplier = 0;
for(int start=0; start<binaryNumber.length(); start++)
{
len--;
e= (int) Math.pow(2,len);
if(binaryNumber.charAt(start)... | 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 |
public void notifyPropertyChangeListeners(int oldMoney, int newMoney) {
PropertyChangeEvent event = new PropertyChangeEvent(this, "money", oldMoney, newMoney);
for(PropertyChangeListener listener:listeners) {
listener.propertyChange(event);
}
} | 1 |
@Override
public void run() {
try {
sendBlockMangerData();
} catch (Exception e) {
EIError.debugMsg("Error Sending Block Manager Data..." + e.getMessage());
}
} | 1 |
@Override
public String toString() {
String typ = "Illegal";
switch (type) {
case TYPE_HELLO:
typ = "Hello";
break;
case TYPE_KNOCK:
typ = "Knock";
break;
case TYPE_BUSY:
typ = "Busy";
break;
case TYPE_BYE:
typ = "Bye";
break;
}
return "Hello(" + typ + ", " + version + ")";
} | 4 |
public DeviceInfoType createDeviceInfoType() {
return new DeviceInfoType();
} | 0 |
private static void doAddTest()
{
System.out.print("Testing add command ");
try
{
File testFolder = new File( TEST_FOLDER );
// remove mvds
File[] mvds = testFolder.listFiles();
for ( int i=0;i<mvds.length;i++ )
{
if ( mvds[i].isFile() && mvds[i].getName().endsWith(".mvd") )
mvds[i].delet... | 9 |
public String[] generateTextFromPicture( BufferedImage im, int aCols )
{
Raster data = im.getData();
StringBuffer ret = new StringBuffer("");
double xresolution = im.getWidth() / (double)aCols;
double yresolution = xresolution * sHeightToWidthRatio;
int lRows = (int) (im.getHeight() / yresolution );... | 4 |
@SuppressWarnings("unchecked")
static boolean setThreadedLocal(String classname, String field, Object value) {
if (Functions.isEmpty(classname)) return false;
if (Functions.isEmpty(field)) return false;
try {
Class<?> c = Class.forName(cn(classname));
if (c == null) return false;
if (c.isEnum()) return ... | 6 |
public List<OrderSubstatus> possibleCancellationReasons(OrderStatus for_status)
{
List<OrderSubstatus> ret = new ArrayList<>();
switch(for_status)
{
case PROCESSING:
ret = Arrays.asList(USER_UNREACHABLE, USER_CHANGED_MIND, USER_REFUSED_DELIVERY, USER_REFUSED_PRODUCT, SHOP_FAILED, REPLACING_ORDER);
bre... | 3 |
public static void updateUpdater() {
File root=new File(Main.path);
root.mkdir();
double version=0.0;
//Get current updater jar version from web
try {
URL url=new URL("http://"+Main.ip+"/d0941e68da8f38151ff86a61fc59f7c5cf9fcaa2/computer/updaterVersion.html");
... | 4 |
private void do_cross_validation()
{
int i;
int total_correct = 0;
double total_error = 0;
double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0;
double[] target = new double[prob.l];
svm.svm_cross_validation(prob,param,nr_fold,target);
if(param.svm_type == svm_parameter.EPSILON_SVR ||
param.s... | 5 |
@Override
public void run()
{
while (enabled)
{
if (logQueue.size() != 0)
{
StringBuilder stringBuilder = new StringBuilder();
while (logQueue.size() != 0)
{
stringBuilder.append(logQueue.poll());
... | 9 |
public DataFinder Where(String field, Object value) throws NoSuchFieldException, SecurityException
{
Field searchField = searchClass.getField(field);
Index annotation = searchField.getAnnotation(Index.class);
if (annotation == null)
throw new IllegalArgumentException(field);
conditions.put(annotation.Ind... | 1 |
public void update() {
if (!arrived) {
if (Point2D.distance(currentTileX, currentTileY, endTile.getX(), endTile.getY()) < velocity) {
currentTileX = endTile.getX();
currentTileY = endTile.getY();
arrived = true;
dealDamage();
... | 4 |
private void shiftPaletteBackward() {
if(color_cycling_location > 0) {
color_cycling_location--;
if(color_choice == palette.length - 1) {
temp_color_cycling_location = color_cycling_location;
}
}
else {
return;
}
... | 9 |
private Object resume(Context cx, Scriptable scope, int operation,
Object value)
{
if (savedState == null) {
if (operation == GENERATOR_CLOSE)
return Undefined.instance;
Object thrown;
if (operation == GENERATOR_THROW) {
... | 7 |
private void programmerSaveButton(java.awt.event.ActionEvent evt)
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Please Enter File Name and Choose Location");
List<String> userInput = Arrays.asList(programmerText.getText().split("\n"));
PrintWriter out =... | 3 |
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.