text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean getDirection (char current, char[] neighbors){
if(current == neighbors[4] || current == neighbors[6]){
return true;
} else {
return false;
}
} | 2 |
private int scoreBowl(int[] bowl) {
int score = 0;
for (int i = 0; i < preferences.length; i++) {
score += bowl[i] * preferences[i];
}
return score;
} | 1 |
@Test
public void KATest() {
userInput.add("hi");
userInput.add("daniel");
userInput.add("can you help me in the kitchen");
userInput.add("bring me something");
userInput.add("bring me sausage");
userInput.add("yes");
userInput.add("ingredient");
userInput.add("supermarket");
userInput.add("bring me sausage");
removabl... | 7 |
public JLabel getjLabelLogin() {
return jLabelLogin;
} | 0 |
@Override
public void absolute(final int localPointer) {
if (localPointer < 0 || localPointer >= rows.size()) {
throw new IndexOutOfBoundsException("INVALID POINTER LOCATION: " + localPointer);
}
pointer = localPointer;
currentRecord = new RowRecord(rows.get(pointer), me... | 2 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int k=input.nextInt();
char q;
for(int r=0;r<k;r++){
String path=input.next();
int count=0,y=0,x;
for(int i=0;i<path.length();i++... | 5 |
public TurnChanger (Player player1, Player player2){
turn = 0;
players[0]=player1;
players[1]=player2;
} | 0 |
public void visit_castore(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
private static void attackBala(Ant ant) {
int XLoc = ant.getLocationX();
int YLoc = ant.getLocationY();
int randNum = RandomNumGen.randomNumber(0, 3);
// 50% Chance of killing a Bala ant in the same node as the soldier ant
if (randNum == 1 || randNum == 3) {
// Iterates through the linked list of b... | 5 |
private void onClick() {
String newStatus;
String callNumber = textFields.get(0).getText().trim();
int copyNo;
if (!isNumeric(textFields.get(1).getText().trim())){
popMsg("copyNo must be a number!");
return;
}
copyNo = Integer.parseInt(textFields.get(1).getText().trim());
// check if book exists
... | 5 |
public boolean placePiece(Piece piece, int x, int y) { // colocando peça no pre-jogo
if (status == statusPreGame) {
if (board.getPiece(x, y) == null) { // lugar vazio
int id = piece.getRank();
int co = piece.getColor();
if (co == teamRed && isRedField(x, y)) {
if (redCollected[id - Piece.pSpy] > ... | 8 |
public int addEmployee(String fname, String lname, String email)
throws ServletException {
//TODO implement method that adds an employee to repository
//This method should check that email is not used by other employees
if (fname.equals("") || lname.equals("") || email.equals("")){
t... | 5 |
public static boolean moveSpot(NPC npc) {
WorldTile key = new WorldTile(npc);
WorldTile spot = moveSpots.get(key);
if (spot == null && moveSpots.containsValue(key)) {
for (WorldTile k : moveSpots.keySet()) {
WorldTile v = moveSpots.get(k);
if (v.getX() == key.getY() && v.getY() == key.getX()
&& v... | 7 |
private void readBounds( BoxData<?> data, XElement xparent ) {
XElement xbounds = xparent.getElement( "bounds" );
data.setX( xbounds.getElement( "x" ).getInt() );
data.setY( xbounds.getElement( "y" ).getInt() );
data.setWidth( xbounds.getElement( "width" ).getInt() );
data.setHeight( xbounds.getElement( "heig... | 1 |
public static List<String> readWebPage(String url)
{
ArrayList<String> toRet = new ArrayList<String>();
@SuppressWarnings("resource")
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = null;
do
{
try
{
response = client.execute(request);
... | 6 |
public String echo(String input) throws java.rmi.RemoteException {
connect();
if (echoSocket != null && os != null && is != null) {
try {
os.println(input);
os.flush();
output= is.readLine();
} catch (IOException e) {
System.err.println("I/O failed in reading/writing... | 4 |
@Test
public void testPlayerIterator() {
int i = 0;
int count = 0;
for (Player p : testGame.getTableIterator(players.get(i))) {
assertEquals(players.get(i), p);
i++;
if (i == players.size()) {
i = 0;
}
count++;
}
assertEquals(0, i);
assertEquals(players.size(), count);
i = 1;
cou... | 8 |
@Override
protected Integer compute() {
int sum = 0;
if((start - end) < THRESHOLD){
for(int i = start; i< end;i++){
sum += i;
}
}else{
int middle = (start + end) /2;
Calculator left = new Calculator(start, middle);
C... | 2 |
public static void one_test(TestHolder test) throws Exception {
System.out.print(test);
char expect = test.expect.charAt(0);
RE re;
try {
re = new RE(test.patt);
} catch (RESyntaxException e) {
boolean success = (expect == 'c');
// If we expected success but got failure, throw.
if (!success) { ... | 4 |
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// System.out.println("Ending -->" + qName);
try {
if (currenttag.equals(TagName.ID) && isFirst) {
pageid = sb.toString();
currentPage.setId(pageid);
isFirst = false;
//IndexingTools.init();
}... | 8 |
public boolean verifyJavaVersion()
{
if (!System.getProperty("os.name").startsWith("Windows"))
{
return true;
}
String version = System.getProperty("java.version");
double ver = Double.parseDouble(version.substring(0, 3));
int build = Integer.parseInt(version.substring(6));
return ver == JAVA_VERSION_... | 2 |
private void checkOSStarted(VirtualMachine virtualMachine) throws Exception {
String startTimeout = virtualMachine
.getProperty(VirtualMachineConstants.START_TIMEOUT);
boolean checkTimeout = startTimeout != null;
int remainingTries = 0;
if (checkTimeout) {
remainingTries = Integer.parseInt(startTimeout... | 5 |
public static void main(String[] args) {
Scanner inFile = null;
try {
// Create a scanner to read the file, file name is parameter
inFile = new Scanner(new File(System.getProperty("user.dir")
+ "/src/Files/prog464a.dat"));
} catch (FileNotFoundException e) {
System.out.println("File not found!");
... | 7 |
@Override protected boolean canFigureMove(Point x, Point Abs) {
if (((x.x == 2 || x.x == -2) && (x.y == 1 || x.y == -1) ||
(x.y == 2 || x.y == -2) && (x.x == 1 || x.x == -1)) &&
!C.isFigure(Abs))
return true;
return false;} | 9 |
public ExternalFilesystem(String basedir) throws IOException
{
if (basedir.endsWith("/") || basedir.endsWith("\\"))
basedir = basedir.substring(0, basedir.length() - 1);
baseDirectory = new File(basedir);
if (!baseDirectory.exists()) throw new IOException("Directory '" + basedir... | 4 |
public static QuadVector<String,Integer,Integer,Boolean> cabilities(HTTPRequest httpReq)
{
final QuadVector<String,Integer,Integer,Boolean> theclasses=new QuadVector<String,Integer,Integer,Boolean>();
if(httpReq.isUrlParameter("CABLES1"))
{
int num=1;
String behav=httpReq.getUrlParameter("CABLES"+num);
... | 7 |
public static void main(String args[]) {
int a = 0;
int b = 0;
int c = 0;
int sum;
int sqr;
int product;
loop : for (c = 2; c > 0; c++) {
for (b = 1; b < c; b++) {
for (a = 1; a < b; a++) {
sqr =(int)(Math.pow(a, 2... | 5 |
public void setNeighbors(Cell[] neighbors) {
this.neighbors = neighbors;
} | 0 |
private void handleError(String message, Exception e)
{
MessageDialog.getInstance().showError(message);
LOGGER.error(message, e);
} | 0 |
private List<MorrisLineAdjacent> getSkewUpLineAdjacent() {
List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>();
boolean bsru = this.hasSkewRightUp();
boolean bsld = this.hasSkewLeftDown();
MorrisLineAdjacent oneLine = null;
if (bsru && bsld) { //this is in the middle
oneLine = new MorrisLi... | 6 |
private NoB busca(NoB no, int x) {
NoB pt = no;
if (pt == null) return null ; //nao achou
else {
pt = pt.proximo;
while (pt.proximo != null && pt.chave < x) pt = pt.proximo;
if (pt.chave < x && pt.pagina != null) pt = busca(pt.pagina,x);
else if (pt.chave > x && pt.anterior.pagina != null) pt = busca(... | 7 |
public long getTransferRate() {
long time = (System.currentTimeMillis() - _startTime) / 1000;
if (time <= 0) {
return 0;
}
return getProgress() / time;
} | 1 |
public void detectAll(){
for(int baud : BAUD_RATES) {
SerialPort serialPort = null;
InputStream in = null;
OutputStream out = null;
try {
log.info("Opening serial port...");
serialPort = (SerialPort) port... | 7 |
public void monitotarPressao(float pressao, Paciente paciente)
throws ControllerException {
try {
if (pressao < 0 || pressao > 30) {
throw new ControllerException("valor da pressão é inválido");
}
if (ValidarPaciente(paciente) && (pressao < 8 || pressao > 12)) {
Publish publish = new Publish(paci... | 8 |
public CheckResultMessage checkDayofMonth() {
int r1 = get(2, 2);
int c1 = get(3, 2);
date();
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (!(getValueString(r1 + 1, c1 - 1, 0)
.equals(lastMaxDay + "日") && getValueString(... | 7 |
private final int method1104(Model class124_101_, int i, int i_102_,
short i_103_) {
anInt1858++;
int i_104_ = ((Model) class124_101_).vertexX[i_102_];
int i_105_ = ((Model) class124_101_).vertexY[i_102_];
int i_106_ = ((Model) class124_101_).vertexZ[i_102_];
for (int i_107_ = i; i_107_ < ((Model) this).verti... | 5 |
private Dock getDockInternal() {
for (DockLayoutNode child : mChildren) {
if (child instanceof DockContainer) {
return (Dock) ((DockContainer) child).getParent();
} else if (child instanceof DockLayout) {
Dock dock = ((DockLayout) child).getDockInternal();
if (dock != null) {
return dock;
}... | 4 |
public void run() {
try {
writeRouteLog(msgEvent, msg);
Logger.getLogger(WriteLog.class.getName()).log(Level.SEVERE, "Записано " + WriteLog.getCurrentTime());
} catch (IOException ex) {
Logger.getLogger(WriteLog.class.getName()).log(Level.SEVERE, null, ex);
}
... | 1 |
private static Object
normaliseObject(
Object o )
{
if ( o instanceof Integer ){
o = new Long(((Integer)o).longValue());
}else if ( o instanceof Boolean ){
o = new Long(((Boolean)o).booleanValue()?1:0);
}else if ( o instanceof Float ){
o = String.valueOf((Floa... | 6 |
public void saveAlbumsPhotos(String folderToSave) {
MyDownloadExecutor executor = new MyDownloadExecutor(nThreads);
for (Album album : albums) {
File folder = new File(folderToSave + album.getAid() + "_" + fixWindowsFileName(album.getTitle()));
boolean success = folder.mkdirs();
... | 6 |
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 fe... | 6 |
public void keyPressed(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key pressed: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
this.upPress = true;
break;
case KeyEvent.VK_DOWN:
System.out.println("down");
this.downPress = true;
break;
cas... | 6 |
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 |
private ButtonType getButtonType(int keyCode) {
switch (keyCode) {
case KeyEvent.VK_UP:
return ButtonType.Up;
case KeyEvent.VK_DOWN:
return ButtonType.Down;
case KeyEvent.VK_LEFT:
return ButtonType.Left;
case KeyEvent.VK_RIGHT:
return ButtonType.Right;
case KeyEvent.VK_SPACE:
return... | 8 |
public void testWithFieldAdded_DurationFieldType_int_5() {
LocalDate test = new LocalDate(2004, 6, 9);
try {
test.withFieldAdded(DurationFieldType.hours(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public static <T, E extends Exception> T validateHandler(OwnerView view, T parameterToValidate, Validator<T, E> validator, MethodProvider<T> methodProvider) {
List<E> validateExceptionList = validator.validate(parameterToValidate);
if (!validateExceptionList.isEmpty()) {
view.printValidateE... | 1 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0)
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS))
&&((msg.amITarget(affected))))
{
final MOB target=(MOB)msg.target();
if((!target.isInCombat())
&&(msg.source().isMonst... | 8 |
public List<Speciality> getSpecialityList() {
return specialityList;
} | 0 |
private static void printMembers(Member[] mems){
for (Member m : mems) {
Annotation[] annotations = new Annotation[0];
if (m instanceof Field) {
annotations = ((Field)m).getAnnotations();
}
if (m instanceof Constructor) {
annotations = ((Constructor<?>)m).getAnnotations();
}
if (m instanceo... | 7 |
final Class27_Sub1 method703(boolean flag1, int i) {
Class27_Sub1 class27Sub1 = (Class27_Sub1) Class142_Sub27_Sub6.aMRUNodes_4752.getObjectForID((flag1 ? 0x40000 : 0) | (anInt1013 | i << 16));
if (class27Sub1 != null) {
return class27Sub1;
}
Class137.aClass73_2264.method791(a... | 6 |
public double evaluateSubset (BitSet subset) throws Exception {
int [] fs;
int i;
int count = 0;
for (i=0;i<m_numAttribs;i++) {
if (subset.get(i)) {
count++;
}
}
double [] instArray = new double[count];
int index = 0;
fs = new int[count];
for (i=0;i<m_numAttribs;i++) {... | 8 |
public void readXML() {
try {
File xmlFile = new File("basedados.xml");
DocumentBuilderFactory documentFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder documentBuilder = documentFactory
.newDocumentBuilder();
Document doc = documen... | 5 |
public String getName(){
return file.getName();
} | 0 |
public static MDDManager getProxy(MDDStore store, List<?> customOrder) {
MDDVariable[] rawVariables = store.getAllVariables();
// build order mapping
boolean sameOrder = rawVariables.length == customOrder.size();
int[] custom2store = new int[customOrder.size()];
for (int i=0 ; i<custom2store.length ; i++) ... | 8 |
private void loadAvaliblePlattformar() {
try {
ArrayList<String> plattemp = DB.fetchColumn("select pid from PLATTFORM");
ArrayList<Plattform> platt = new ArrayList<>();
for (String st : plattemp) {
platt.add(new Plattform(Integer.parseInt(st)));
}
... | 3 |
public boolean checkBlockInitializer(InvokeOperator invoke) {
if (!invoke.isThis() || invoke.getFreeOperandCount() != 0)
return false;
MethodAnalyzer methodAna = invoke.getMethodAnalyzer();
if (methodAna == null)
return false;
FlowBlock flow = methodAna.getMethodHeader();
MethodType methodType = methodA... | 9 |
private HashMap<Article, Location> findArticle(int articleID, int quantity)
{
HashMap<Article, Location> map = new HashMap<Article, Location>();
for (Location location : locations) {
for (int i = 0; i < location.getArticles().size() && quantity > 0; i++) {
if (location.getArticles().get(i).getArticleID() ... | 4 |
protected Container createComboBox(final Object[] args) {
final String tip =
((args.length > 0) && (args[0] != null))
? args[0].toString()
: null;
final String text =
((args.length > 1) && (args[1] != null))
? args[1].toStri... | 9 |
public void close() {
ServerLogger.info(Server.class, "Closing server", null);
stopDataServers();
try {
outputStream.close();
} catch (IOException e) {
// do nothing
}
try {
inputStream.close();
} catch (IOException e) {
// do nothing
}
try {
connectionSocket.close();
} catch (IOExc... | 3 |
public void sendInterrupt (byte buf [])
throws IOException
{
if ("interrupt" != getType () || buf.length > getMaxPacketSize ())
throw new IllegalArgumentException ();
if (spi == null)
spi = iface.getDevice ().getSPI ();
// FIXME getInterval() ms timeout (caller guarantees periodicity)
spi.writeInt... | 3 |
public void bubble ()
{
char temp; // tijdelijke opslag van de waarde
int i, j; // waarde 1, 2
for (j = 0; j < rij.length; j++) // voor elke j kleiner dan de lengte van rij
{
for (i = 1; i < rij.length - j; i++) // voor elke i kleiner dan de lengte van rij - j
... | 3 |
private void updateQueues()
{
while(!taskSet.isEmpty() && taskSet.peek().getArrivalTime() <= currentTime)
{
if(isPreSatisfied(taskSet.peek()))
{
readyQueue.addLast(taskSet.poll());
}
else
{
Task t = taskSet.poll();
t.setWaiting();
waitQueue.addLast(t);
}
}
for(Task t : waitQu... | 8 |
public PublicKey decodePublicKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[0]
|| k[1] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[1]
|| k[2] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[2]
|| k[3] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[3]) {
throw new Ill... | 5 |
public static int byteArrayToInt(byte[] b) {
// 0是高位,3是低位
// 每次取最高8位
int i = (b[0] << 24) & 0xFF000000;
i |= (b[1] << 16) & 0xFF0000;
i |= (b[2] << 8) & 0xFF00;
i |= b[3] & 0xFF;
return i;
} | 0 |
@SuppressWarnings("unchecked")
public List<Customer> getAllCustomers() {
return (List<Customer>) this.em.createNamedQuery("findAllCustomers")
.getResultList();
} | 0 |
public Instruction newInstruction(MethodModel _methodModel, ByteReader byteReader, boolean _isWide) {
Instruction newInstruction = null;
if (clazz != null) {
try {
final Constructor<?> constructor = clazz.getDeclaredConstructor(MethodModel.class, ByteReader.class, boolean.c... | 8 |
@SuppressWarnings("rawtypes")
private String getEnumValue(final Field field, final Object object) {
String resValue = null;
Object value = getRawValue(field, object);
if (value != null) {
int valEnum = ((Enum) value).ordinal();
resValue = String.valueOf(valEnum);
}
return resValue;
} | 1 |
@SuppressWarnings("unchecked")
private void initGUI()
{
// C O M P O N E N T S ---------------------------------------------
this.jcbState = new JComboBox<ImageIcon>(EzimImage.icoStates);
this.jcbState.setEditable(false);
this.jcbState.addItemListener
(
new ItemListener()
{
public void itemStateCh... | 4 |
public void update(float delta){
Vector2D position = circleShape.getPosition();
if((position.x -radius/2)<0){ circleShape.setXPosition(radius/2); velocity.thisBounceNormal(new Vector2D(1,0));}
if((position.x +radius/2)>GamePanel.WIDTH){ circleShape.setXPosition(GamePanel.WIDTH-radius/2);... | 6 |
@Test
public void runTestArrayAccess2() throws IOException {
InfoflowResults res = analyzeAPKFile("ArraysAndLists_ArrayAccess2.apk");
Assert.assertEquals(0, res.size());
} | 0 |
public static boolean isValidOption(String option) {
if (GRE_OPTION_A.equals(option) || GRE_OPTION_B.equals(option)
|| GRE_OPTION_C.equals(option) || GRE_OPTION_D.equals(option)
|| GRE_OPTION_E.equals(option)) {
return true;
}
return false;
} | 5 |
private void method392(byte abyte0[], int i, int j, int k, int l, int i1) {
int j1 = i + j * width;
int k1 = width - k;
int l1 = 0;
int i2 = 0;
if (j < topY) {
int j2 = topY - j;
l -= j2;
j = topY;
i2 += j2 * k;
j1 += j2... | 6 |
void loadSettings(String name, String value) throws Exception {
if(name==null) return;
if(name.equals("name")) { //$NON-NLS-1$
documentName=value;
}
if(name.equals("author")) { //$NON-NLS-1$
documentAuthor=value;
}
if(name.equals("date")) { //$NON-NLS-1$
documentDate=new SimpleDateFormat("yyyy/M... | 7 |
private void createSlide(Attributes attrs) {
slide = new Slide(slideDef);
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("id"))
slide.setId(Integer.valueOf(attrs.getValue(i)));
else if (attrs.getQName(i).equals("backg... | 8 |
public float getPhysicalWidthInch() {
int w = getWidth();
int pw = getPhysicalWidthDpi();
if (w > 0 && pw > 0) {
return ((float)w) / ((float)pw);
} else {
return -1.0f;
}
} | 2 |
public static int getID(String usu){
String sql = " SELECT idusuarios FROM usuarios WHERE usuario = '"+usu+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return 0;
}
if(!BD.getInstance().sqlFetch()){
return 0;
}
return BD.getInstance().getInt(... | 2 |
public void step() {
if (board.getState() == State.GAME_OVER) {
board.clear();
board.setState(State.PLAYING);
}
if (board.fallingBlock == null) {
board.addFallingBlock(tm.getPoly(rand.nextInt(tm.getNumberOfTypes())));
}
if (CollisionDetector.... | 4 |
public ProductDao getProductDao(){
if(productDao==null)
productDao=new ProductDaoImpl();
return productDao;
} | 1 |
protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
ContainerFigure container = new ContainerFigure();
if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
}
if (!... | 8 |
public static void main(String[] args) {
PlayerReplayer playerReplayers[] = new PlayerReplayer[NUM_SLOTS];
Scanner input;
int num = 0;
File dir = new File(Position.GAME_NAME + "Commands");
String inputfilename;
File[] directoryListing = dir.listFiles();
if (directoryListing != null) {
... | 8 |
private void options() {
final Stage dialog = new Stage();
initializeDialog(dialog);
Label label = new Label(txt);
defaultVolume = makeVolumeSlider();
Button okButton = new Button("OK");
okButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
... | 2 |
public void takeFromContainer(int playerID, int index) {
Player p = this.playerIDs.get(playerID);
if (p != null) {
Location on = p.getLocationInFrontOf();
if (board.tileAt(on).getOn() != null && board.tileAt(on).getOn() instanceof Inventory) {
Inventory takingFrom = (Inventory)board.tileAt(on).getOn();
... | 6 |
public static void startupPartialMatch() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, (... | 7 |
@Override
public boolean remove(T element) {
int i = 0;
int hashCode = element.hashCode() % hashTable.size();
if (keyCode.get(hashCode).equals("f") && hashTable.get(hashCode).equals(element)) {
hashTable.set(hashCode, null);
keyCode.set(hashCode, "r");
return true;
} else if (keyCode.get(hashCode).equ... | 7 |
private static void showWallet(ApiAuthorization auth, int acId) {
AbstractWalletTransactionsParser parser = WalletTransactionsParser.getInstance();
WalletTransactionsResponse response;
try {
response = parser.getResponse(auth, 1000);
Set<ApiWalletTransaction> walletTransactions = response.getAll();
Deci... | 2 |
public static YearsStatisticsByCities convert(
CitiesStatisticsByYears statisticsByYears) {
YearsStatisticsByCities yearsStatisticsByCities = new YearsStatisticsByCities();
Map<City, EmployeesStatisticsByYears> emplByCities = new TreeMap<City, EmployeesStatisticsByYears>();
EmployeesStatisticsByYears employe... | 3 |
public void addChunk() {
String chunkName = null;
List<DataNodeEntry> locations = null;
try {
chunkName = this.nameNodeStub.nameChunk();
if (Hdfs.Core.DEBUG) {
System.out.println("DEBUG HDFSFile.addChunk(): chunk name:" + chunkName);
}
locations = this.nameNodeStub.select(this.replicaFactor);... | 5 |
@Test
public void testGetMarker() {
System.out.println("getMarker");
Unmark instance = new Unmark(6, 9);
int expResult = 6;
int result = instance.getMarker();
assertEquals(expResult, result);
} | 0 |
public static void insertSqlCommandTemplate(PropertyList template) {
{ Stella_Object commandname = template.lookup(Sdbc.KWD_COMMAND);
{ Stella_Object temp000 = template.lookup(Sdbc.KWD_DATA_SOURCE);
{ Cons datasources = (((temp000 != null) ? temp000 : Sdbc.KWD_DEFAULT)).consify();
Stella_O... | 6 |
private boolean checkSpawnerLocation(int x, int y){
for(int ya = y - spawnerRadius; ya < y + spawnerRadius + 1; ya++){
for(int xa = x - spawnerRadius; xa < x + spawnerRadius + 1; xa++){
if(!checkBounds(xa, ya)) continue;
if(!getTile(xa, ya).equals(Tile.floorTile)) return false;
}
}
return true;
} | 4 |
public void updateUserbyUserName(final String name, final String pass, final String phone,
final int type) {
for (User u : userList.getUserList()) {
if (name.equals(u.getName())) {
u.setPassword(pass);
u.setPhoneNumber(phone);
u.setType(ty... | 2 |
public void truncate(float max) {
if(this.length() > max) {
this.normalize();
this.x *= max;
this.y *= max;
}
} | 1 |
private void DownLoad10K(String urlStr, String outPath) {
// the length of input stream
int chByte = 0;
// the url of the doc to download
URL url = null;
// HTTP connection
HttpURLConnection httpConn = null;
InputStream in = null;
FileOutputStream out = null;
try {
url = new URL(urlStr);
http... | 4 |
@Override
public IReceiveQuery getReceiveQuery() {
return receiveQuery;
} | 0 |
public void generate() {
final int maxHeight = HEIGHT / 2;
final int stepHeight = maxHeight / 75 * blockSize;
int maxBlockHeight = 0;
blockHeights[0] = Util.rand(maxHeight);
for (int i = 1; i < blocksCount; i++) {
int value = blockHeights[i - 1] + Util.rand(-... | 7 |
public void run() {
debug("GC: started");
synchronized (this) {
for (; ;) {
while (rrdMap.size() > capacity && rrdGcList.size() > 0) {
try {
RrdEntry oldestRrdEntry = (RrdEntry) rrdGcList.get(0);
debug("GC: closing " + oldestRrdEntry.dump());
removeRrdEntry(oldestRrdEntry);
} catc... | 5 |
public boolean deduplicate (ObjectatEvent event) {
boolean success = false;
// Update last timestamp
this.setLast(new Date());
// Update count
this.setEventCount(this.getEventCount() + 1);
if (event.isOwned() != this.isOwned()) {
if (this.logger != null) {
this.logger.log(ObjectatLogLevel.DE... | 9 |
public static void main( String[] args )
{
WorkBookHandle book = null;
try
{ // generate a PDF and confirm
// load the current file and output it to same directory
book = new WorkBookHandle( System.getProperty( "user.dir" ) + "/docs/samples/Input_CSV/contacts.csv" );
System.out.println( book.getStats() ... | 5 |
public Point fight(){
int aLost = 0;
int dLost = 0;
// Resets dice values
d[DEFENDERFIRST]=0;
d[DEFENDERSECOND]=0;
a[ATTACKERFIRST]=0;
a[ATTACKERSECOND]=0;
a[ATTACKERTHIRD]=0;
unitsAttacker = getFirstTerritory().getNbrOfUnits() - 1;
unitsDefender = getSecondTerritory().getNbrOfUnits();
fo... | 9 |
public int[][] AllPairsShortestPath(int[][] matrix) {
int numberVertices = matrix.length;
// create new storage container for path and weight information
path = new int[numberVertices][numberVertices];
pathWeights = new int[numberVertices][numberVertices];
// Initialise containers;
for (int i ... | 8 |
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.