text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static ArrayList<Long> readNumbersArrayFromFile()
{
ArrayList<Long> longArray = new ArrayList<Long>();
FileInputStream fstream = null;
try
{
fstream = new FileInputStream("algo1-programming_prob-2sum.txt");
// Get the object ... | 4 |
public void createNextGeneration(ArrayList<BuildOrder> orders) {
Gson gson = new Gson();
System.out.println("The following build orders will survive in the gene pool: ");
for (BuildOrder order : orders) {
System.out.println(gson.toJson(order));
}
try {
File knowledgeBase = new File(knowledgeBasePath);... | 6 |
public void printViterbi(boolean getBest) {
Iterator<String> myIt=ViterbiEndpoint.keySet().iterator();
String myStr;
boolean entered=false;
double bestVal=2;
String bestStr="";
while (myIt.hasNext()) {
myStr=myIt.next();
if (!entered || bestVal< ViterbiEndpoint.get(myStr))
{bestVal=ViterbiEndpo... | 5 |
public boolean equals(DisplayState other) {
if(other == null) return false;
return other.getCurrState() == this.getCurrState() &&
this.getImageIndex() == other.getImageIndex() &&
this.commands.equals(other.getCommands());
} | 3 |
void sendBytes ( final Socket sock ) throws IOException {
@SuppressWarnings ( "resource" )
OutputStream out = sock.getOutputStream();
byte[] buf = new byte[this.bytesSent];
for ( int i = 0; i < this.bytesSent; i++ ) {
buf[ i ] = (byte) ( i + 'A' );
}
out.write... | 1 |
static String getQudrantXY(String v, String h) {
int hor = Integer.valueOf(h);
int vert = 1;
if (v.equals("b")) {
vert = 2;
} else if (v.equals("c")) {
vert = 3;
} else if (v.equals("d")) {
vert = 4;
} else if (v.equals("e")) {
vert = 5;
} else if (v.equals("f")) {
vert = 6;
} else if ... | 8 |
public void updateFont(List<Font> fonts, int startFrom, int endAt) {
int i, j;
for (i = startFrom, j = 0; i <= endAt; i++, j++) {
this.children.get(i).setFont(fonts.get(j));
}
this.modelChanged();
} | 1 |
private void processSendButton() {
//
// make sure the the specified file exits
//
String fileName = fFileFullPathname.getText();
File file = null;
String[] recipients = null;
WarningUI warning = null;
if (fileName.length() == 0) {
warning = n... | 6 |
private static void lisaaAveceja(int aveceja, ArrayList<Sitsaaja> sitsaajat) {
int i = 0;
do {
Sitsaaja sitsaaja = Yhteydet.annaRandomSitsaaja(sitsaajat);;
do {
sitsaaja = Yhteydet.annaRandomSitsaaja(sitsaajat);
} while (sitsaaja.puolisoIsSet() == true... | 5 |
@Test
public void testSetFood() throws IOException {
System.out.println("setFood");
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
boolean expResult = false;
boolean result = instance.getFood();
assertEquals(expResult, resu... | 0 |
public boolean containsValue(Object value) {
if (value == null) {
for (int i = 0, isize = data.length; i < isize; i++) {
HashEntry entry = data[i];
while (entry != null) {
if (entry.getValue() == null) {
return true;
... | 7 |
public static void main(String[] args){
Application app = new Application();
app.run();
System.exit(0);
} | 0 |
public boolean modelTypeCached(int modelType) {
if (modelTypes == null) {
if (modelIds == null)
return true;
if (modelType != 10)
return true;
boolean cached = true;
for (int id = 0; id < modelIds.length; id++)
cached &= Model.isCached(modelIds[id] & 0xffff);
return cached;
}
for (int ... | 6 |
public static <T, A extends Annotation> String getClassAnnotationValue(Class<T> classType, Class<A> annotationType, String attributeName) {
String value = null;
Annotation annotation = classType.getAnnotation(annotationType);
if (annotation != null) {
try {
value = (String) annotation.annotationType().getM... | 2 |
@Test(groups = { "Character-Sorting", "Fast Sort" })
public void testHeapSortChar() {
Reporter.log("[ ** Heap Sort ** ]\n");
try {
testSortCharacters = new HeapSort<>(
fastShuffledArrayChar.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMillis();
testSortC... | 4 |
public void remotePlayerPutCard(Player p, Card c) {
TurnContext cx = p.getCurrentContext();
CardRange r = getCorrespondingCardRange(cx.currentPlayable, p);
CardEntity ent = null;
boolean found = false;
cardsReadLock.lock();
try {
int remaining = r.getLength();
for (Iterator<CardEntity> iter = cards.li... | 5 |
public void setTargetPoint( EndPoint targetPoint ) {
ConnectionArray array = null;
if( this.targetPoint != null ){
removeChild( this.targetPoint );
array = this.targetPoint.getArray();
if( array != null ){
array.remove( this.targetPoint );
}
this.targetPoint.setConnection( null );
}
this.t... | 4 |
public NodeSetTransferable(NodeSet nodeSet) {
super(nodeSet.toString());
this.nodeSet = nodeSet;
} | 0 |
public AsetInterface shortestPath() {
VertexInterface r, pivot;
for (VertexInterface x : gi.getGraph()) {
pi.setPoids(x, (int) Integer.MAX_VALUE / 2);
// je divise par 2 parce que Integer.MAX_VALUE+1=Integer.MIN_VALUE
}
r = gi.getDeparture();
pivot = r;
int n = gi.getGraph().size();
for (int j = 1;... | 4 |
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 Font updateFont() {
String fontStr = (String) jlFont.getSelectedValue();
String styleStr = (String) jlFontStyle.getSelectedValue();
int style;
int size = sizeValue[jlFontSize.getSelectedIndex()];
if (styleStr.equals("常规")) {
style = Font.PLAIN;
} else ... | 9 |
public void run()
{
while (thread != null && state == STATE_PLAYING && read != -1) {
if (written >= read) {
try {
read = audioInputStream.read(buffer, 0, buffer.length);
written = 0;
}
catch (IOException e) {
e.printStackTrace();
... | 7 |
public void setName(String name) {
this.name = name;
} | 0 |
public MP3Filter(boolean title, boolean artist, boolean caseSensitive, String searchString) {
super();
filterList = new Vector<MP3Filter.BasicFilter>();
if (caseSensitive) {
this.searchString = searchString;
if (title) {
filterList.add(new TitleFilter());
}
if (artist) {
filterList.add(new... | 5 |
private void CancelTicketButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelTicketButtonActionPerformed
int selRow = ViewHistoryTable.getSelectedRow();
if (selRow == -1) {
jLabel1.setText("Please select a ticket to continue");
return;
... | 7 |
static String nextBlackMove(){
if(!blackOpening.isEmpty())
return blackOpening.remove(0);
else
return null;
} | 1 |
public Game(List<User> u)
{
users = u;
start = System.currentTimeMillis();
System.out.println("Game has been created.");
System.out.println("Team 1: ");
int sumaBlue = 0;
float sredniaBlue = 0;
int sumaPurple = 0;
float sredniaPurple = 0;
for(U... | 4 |
private static void mergeWithPrevVisibleNode(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
Node prevNode = tree.getPrevNode(currentNode);
if (prevNode == null) {
return;
}
// Abort if prevNode is not editable
if (!prevNode.isEditab... | 2 |
private boolean getFilmography(int start, int end, StringBuilder sourceCode, String pattern) {
boolean flag = true;
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(sourceCode);
m.region(start, end);
while (m.find() &&
(end < sourceCode.indexOf("id=\"External_links\"... | 5 |
public PermissionRcon getRcon() throws DataLoadFailedException {
return dataHolder.getRcon();
} | 0 |
public void Loadfile(String xmlfile)
{
File file = new File(xmlfile);
if (!file.exists())
return;
Document doc = null;
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(file);
doc.getDocumentElement().norm... | 6 |
public static boolean addNewDrug(NewDrugPage newDrug){
Drug newd = new Drug();
String quantity = newDrug.getdQuantity().getText();
int quant = Integer.parseInt(quantity);
String cont = newDrug.getdControlled().getText();
String t= "true";
boolean controlledt=false;
controlledt=cont.equals(t);
newd.s... | 1 |
@Override
public void initialize(Vertex start) {
} | 0 |
private final AbstractTrack getTrack(int trackNr)
{
if(trackNr >= 0)
this.trackNr = trackNr;
switch(this.trackNr)
{
default:
case 0:
return this.testtrack;
case 1:
return this.otrack;
case 2:
... | 6 |
protected static Map<DeltaSQLStatementSnapshot, List<WaitEventForStatementTuple>> loadWaitEventsForStatements(
List<DeltaSQLStatementSnapshot> worstStatements,
Calendar startTime,
Calendar stopTime,
ProgressListener progressListener) {
Map<DeltaSQLStatementSnapsh... | 8 |
public long getLong(String key) throws JSONException {
Object o = get(key);
if(o==null) return 0;
if(o instanceof String){
if(o.toString().length()>0){
return Long.valueOf((o.toString()));
}else
return 0;
}
return o instanceof Numbe... | 4 |
private GamePosition blockSeriesOfFourOrMoreInCheckMode(GameBoardMark playerMark) {
int zero = 0;
int upToSquaresPerSide, upToFive, upToSix;
GamePosition position = new GamePosition();
GamePosition position2 = new GamePosition();
for (upToSix = 0; upToSix < 6; upToSix++) {
... | 8 |
public Object match(PathPattern<ServletAction> pattern, PathInput input, MapHttpServletRequest request) {
if (type == Type.DEPLOY) {
try {
Page page = pageClass.newInstance();
input.bind(page);
pattern.match(input);
request.setAttribute... | 2 |
public void handle(String line) {
String[] message = line.split(" ");
String command = message[0].toLowerCase();
for(int x = 0; x < message.length; x++) {
// Misc.println(message[x]);
}
if(command.startsWith("oper")) {
UserOper oper = new UserOper(server);
oper.handleCommand(line);
} else if(comma... | 7 |
public List<Booking> getStudentBookingsByDate(Student student, Calendar date) {
List<Booking> b = new ArrayList<Booking>();
Iterator<Booking> iter;
iter = bookings.iterator();
while (iter.hasNext()) {
Booking booking = iter.next();
if ((booking.getDate().get(Calendar.DAY_OF_MONTH) == date
.get(Calend... | 5 |
public Label newLabel() {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
this.setDirty(true);
return new Label(maxLabel++);
} | 1 |
private void cleanUpImports() {
Integer dummyVote = new Integer(Integer.MAX_VALUE);
SortedMap newImports = new TreeMap(comparator);
List classImports = new LinkedList();
Iterator iter = imports.keySet().iterator();
while (iter.hasNext()) {
String importName = (String) iter.next();
Integer vote = (Intege... | 9 |
public static void calculateSimilarities() {
double sim;
for (Integer user1 : userCommunity.keySet()) {
for (Integer user2 : userCommunity.tailMap(user1, false).keySet()) {
sim = computeSimilarity(user1, user2);
// this is for user1's list
if (userSimilarities.containsKey(user1)) {
userSimila... | 4 |
public void init(PolicyFinder finder) {
// now that we have the PolicyFinder, we can load the policies
PolicyReader reader = new PolicyReader(finder, logger, schemaFile);
Iterator it = policyList.iterator();
while (it.hasNext()) {
String str = (String)(it.next());
... | 6 |
public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... | 8 |
private BufferedImage putIntoImageCache(BufferedImage bim, int width, int height, boolean allowScaling) {
// create new Image cache if needed.
if (image == null) {
image = new ImageCache(library);
}
boolean setIsScaledOnImageCache = false;
if (allowScaling && scaleIm... | 7 |
private static List<List<Integer>> Bucketize(List<Integer> candidates, List<Long> primes, int primeSet) {
ArrayList<List<Integer>> result = new ArrayList<List<Integer>>();
for (int i = 0; i < candidates.size(); i++) {
Integer n1 = candidates.get(i);
System.out.print("Candidate=... | 6 |
CPGreyBmp makeVertLinesTexture(int lineSize, int size) {
CPGreyBmp texture = new CPGreyBmp(size, size);
for (int i = 0; i < size * size; i++) {
if (i % size >= lineSize) {
texture.data[i] = (byte) 255;
}
}
return texture;
} | 2 |
@Override
public void reactOnCollision(ElementField element, CollisionMan.TYPE type) {
if (_faced == null || !_faced.equals(element)) {
if (element.mass() == MASS.INF_MASS) {
collideWithUnmovableElement(element, type);
} else {
collideWithMovableElemen... | 3 |
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_SPACE) {
fire();
}
if (key == KeyEvent.VK_LEFT) {
dx = -1;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}
if (key == KeyEvent.VK_UP) {... | 5 |
protected void generateClassFiles(ClassDoc[] arr, ClassTree classtree) {
Arrays.sort(arr);
for(int i = 0; i < arr.length; i++) {
if (!(configuration.isGeneratedDoc(arr[i]) && arr[i].isIncluded())) {
continue;
}
ClassDoc prev = (i == 0)?
... | 9 |
public static Cursor getCursor(int id) {
Integer key = Integer.valueOf(id);
Cursor cursor = m_idToCursorMap.get(key);
if (cursor == null) {
cursor = new Cursor(Display.getDefault(), id);
m_idToCursorMap.put(key, cursor);
}
return cursor;
} | 1 |
private static int method516(char arg0[], int arg1) {
for (int k = arg1; k < arg0.length && k >= 0; k++) {
if (arg0[k] < '0' || arg0[k] > '9') {
return k;
}
}
return arg0.length;
} | 4 |
@Override
public void keyPressed(KeyEvent e)
{
final int key = e.getKeyCode();
if (userName.isFocusOwner()) if (key == KeyEvent.VK_ENTER || key == KeyEvent.VK_TAB)
{
password.requestFocus();
return;
}
if (password.isFocusOwner()) if (key == KeyEvent.VK_ENTER || key == KeyEvent.VK_TAB)
{
login.do... | 6 |
@Override
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == btnSubmit){
CustomerDataSource cusDS = new CustomerDataSource();
if(!tfFName.getText().isEmpty() && !tfLName.getText().isEmpty() && !tfPhone.getText().isEmpty() && !cusDS.checkCustomerByPhone(tfPhone.getText()))
{
Custom... | 9 |
@Test
public void runTestButton1() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_Button1.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size());
} | 0 |
public static void readConfigDB() throws Exception {
try {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream in = new FileInputStream(configFile);
if (in.available() == 0) {
throw(new Exception("File not found or empty"));
... | 9 |
public void paintComponent(Graphics g) { //хз, прокатит ли с 2 параметрами
super.paintComponent(g);
x_centr = this.getWidth() / 2;
y_centr = this.getHeight() / 2;
Graphics2D g2d = (Graphics2D) g;
this.setBackground(Color.WHITE);
g2d.setColor(Color.BLACK);
// тестовая... | 7 |
private boolean checkLinesAndColums(String curBoard) {
for (int i = 0; i < 3; ++i) {
if (curBoard.charAt(i * boardSize) == curBoard.charAt(boardSize * i + 1)
&& curBoard.charAt(i * boardSize) == curBoard.charAt(boardSize * i + 2)
&& curBoard.charAt(i * boardSize) != ' ') {
return true;
}
i... | 7 |
public void updateLevel(Game game) {
this.game = game;
for (Tile t : tiles) {
t.tick(game);
if (game.getInput().rightButton && t.isContainsMouse())
rightClick(t);
if (game.getInput().leftButton && t.isContainsMouse())
leftClick(t);
}
} // End update | 5 |
@Override
public int compareTo(Object o) {
if (this == o) return 0;
if (o instanceof CommandBase) {
CommandBase cmd = (CommandBase) o;
int c = (name.compareTo(cmd.name));
if (c != 0) return c;
if (options.size() != cmd.options.size()) return options.size() - cmd.options.size();
for (CommandOption ... | 6 |
public Node selectRandomNode(Node nodeIn) {
List<Node> selectCollection = new ArrayList<Node>();
if (nodeIn.getType() == NodeType.INPUT) {
selectCollection.addAll(outNodes);
selectCollection.addAll(hiddenNodes);
} else if (nodeIn.getType() == NodeType.OUTPUT) {
... | 5 |
private void initCheckSavingReq() {
if (theWorker == null) {
state = UIState.CHECKSAVINGREQUIREMENT;
lblStatus.setText("Checking files on disk");
theWorker = new MyWorker(rootPage, JobType.CHECKSAVINGREQUIREMENT, true);
theWorker.execute();
}
} | 1 |
public void println(String text) {
if(frame == null) buildGUI();
area.append("\n" + text);
} | 1 |
public void gen() {
for (int i = 0; i < tiles.length; i++) {
for (int j = 0; j < tiles[0].length; j++) {
if (r.nextInt(10) > 1) {
tiles[i][j] = new Grass(i * 64, j * 64);
}
else {
tiles[i][j] = new Stone(i * 64, j * 64, this);
}
}
}
} | 3 |
@SuppressWarnings("unchecked")
public static <E> E findFirstMatch(Collection<?> source, Collection<E> candidates) {
if (isEmpty(source) || isEmpty(candidates)) {
return null;
}
for (Object candidate : candidates) {
if (source.contains(candidate)) {
return (E) candidate... | 5 |
public IVPNumber add(IVPNumber number, Context context, DataFactory factory, HashMap map) {
IVPNumber result = factory.createIVPNumber();
map.put(result.getUniqueID(), result);
if(getValueType().equals(IVPValue.INTEGER_TYPE) && number.getValueType().equals(IVPValue.INTEGER_TYPE)){
int resultInt = context.getIn... | 5 |
private void dropElement() throws Exception {
Session s = HibernateUtil.getSessionFactory().getCurrentSession();
try {
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
Object obj = ois.readObject();
if(obj instanceof NetworkHardware) {
s.beginTransaction();
... | 3 |
public static void main(String[] args){
// Example of creating a set and partitioning it:
System.out.println("Starting by creating a partitioned set of 4 elements:");
PartitionListElement<String> list = new PartitionListElement<String>();
list.add("one");
list.add("two");
list.add("three");
list.add("four... | 6 |
public void close() throws XmlRpcException {
if (xmlRpcClient != null) {
xmlRpcClient.close();
}
} | 1 |
public void Partition(int[] a, int k, int begin, int end) {
int left = begin;
int right = end;
int temp = a[left];
while (left < right) {
while (left < right && a[right] >= temp)
right--;
if (left < right)
a[left] = a[right];
while (left < right && a[left] < temp)
left++;
if (left < righ... | 9 |
private void process(File aFile) {
if(aFile.isFile()){
String name = aFile.getName();
if (name.substring(name.length()-4).equals("java")){
try {
if (!name.equals("Command.java") && !name.equals("CommandFactory.java")){
String pack = aFile.getPath().replaceAll("\\\\", ".");
pack = pack.subst... | 9 |
public void addSlower(double x, double y){
Slower t = new Slower(new Vertex2D(x, y), getGos());
if (!touchesAnything(t))
if (y >= .5 * Tower.HEIGHT
&& y <= TDPanel.HEIGHT - .5 * Tower.HEIGHT
&& (y < TDPanel.HEIGHT / 3 - .5 * Tower.HEIGHT || y > 2
* TDPanel.HEIGHT / 3 + .5 * Tower.HEIGHT)
&&... | 8 |
@Override
public double[] intersect(Ray ray) {
// Algorithm: http://www.ray-tracing.ru/articles213.html
Vector3 T = ray.getFrom().subtract(v0);
Vector3 Q = T.crossProduct(e1);
Vector3 P = ray.getDirection().crossProduct(e2);
double pDotE1 = P.dotProduct(e1);... | 5 |
private void dropAlarm() throws Exception {
Session s = HibernateUtil.getSessionFactory().getCurrentSession();
try {
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
Object obj = ois.readObject();
if(obj instanceof Alarm) {
s.beginTransaction();
s.delete(obj... | 3 |
List<Position> getNeighbours() {
List<Position> list = new ArrayList<Position>();
if(this.north != null && this.north.data != '*') {
list.add(this.north);
}
if(this.south != null && this.south.data != '*') {
list.add(this.south);
}
if(this.east != null && this.east.data != '*') {
list.add(this.e... | 8 |
@Override
public boolean equals(Object other) {
if (other == null || !(other instanceof Word))
return false;
else {
Word otherWord = (Word) other;
return Arrays.equals(stresses, otherWord.stresses) &&
Arrays.equals(units, otherWord.units);
}
} | 3 |
public void playSound(String path){
try {
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File(path).getAbsoluteFile());
if (path == "TurretPurchase.wav"){
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();
}
else... | 2 |
public void setPheromoneLevel(int pheromone)
{
amtPheromone = pheromone;
pheromoneLabel.setText("Ph: " + pheromone);
if (pheromone >= 1000)
setBackground(PHEROMONE_1000);
else if (pheromone >= 800)
setBackground(PHEROMONE_800);
else if (pheromone >= 600)
setBackground(PHEROMONE_600);
else if (p... | 7 |
public String getType()
{
return "mealy";
} | 0 |
private SensorSingleData process(List<Double> measurementValues) {
if (isInitialised) {
List<Double> correctedValues = new ArrayList<Double>();
for (int i = 0; i < measurementValues.size(); i++) {
// compute the Kalman gain
double kalmanGain = predictedVariances.get(i) / (predictedVariances.get(i) + noi... | 2 |
public final void actionPerformed(ActionEvent e) {
JTextComponent textComponent = getTextComponent(e);
if (textComponent instanceof RTextArea) {
RTextArea textArea = (RTextArea)textComponent;
//System.err.println("Recordable action: " + getMacroID());
if (RTextArea.isRecordingMacro() && isRecordable()) {
... | 7 |
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((loc == null) ? 0 : loc.hashCode());
return result;
} | 1 |
public void buildAssociations(Instances instances) throws Exception {
Frame valuesFrame = null; /* Frame to display the current values. */
/* Initialization of the search. */
if (m_parts == null) {
m_instances = new Instances(instances);
} else {
m_instances = new IndividualInstances(new I... | 7 |
public boolean isObstacle(Coordinate coord) {
if (getCell(coord).getElementType() == ElementType.WATER
|| getCell(coord).getElementType() == ElementType.LEAFWATER
|| getCell(coord).getElementType() == ElementType.TRUNK
|| getCell(coord).getElementType() == ElementType.WALL)
return true;
else
retur... | 4 |
static final int method2960(boolean bool, int i) {
if (i >= -16)
aFloatArray6865 = null;
anInt6870++;
int i_0_ = ByteBuffer.anInt7207;
while_128_:
do {
do {
if ((i_0_ ^ 0xffffffff) != -1) {
if (i_0_ != 1) {
if (i_0_ == 2)
break;
break while_128_;
}
} else {
if (bool)... | 7 |
public ArrayList<ArrayList<String>> partition(String s) {
int length = s.length();
//initial a indicator:
boolean[][] indicator = new boolean[length][];
for(int i = 0; i < length; ++i){
indicator[i] = new boolean[length];
for(int j = 0; j < length; ++j){
indicator[i][j] = false;
}
}
for(int... | 7 |
public static boolean canAfford(CostType cost) {
if(wood >= cost.wood && stone >= cost.stone && gold >= cost.gold && food >= cost.food) {
return true;
}
return false;
} | 4 |
public void submit(Integer partId) {
System.out.println(String.format("==\n== [nlp] Submitting Solutions" +
" | Programming Exercise %s\n==", homework_id()));
partId = promptPart();
List<String> partNames = validParts();
if(!isValidPartId(partId)) {
System.err.println("!! Invalid ... | 9 |
public void saveAnimation() {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/sprites"));
String line;
StringBuilder fileContent = new StringBuilder();
String newLine = null;
while((line = reader.readLine()) != null) {
String[]... | 5 |
public static void main(String[] args) {
if(args.length == 0){
System.out.println("Specification and assembly filenames not given.");
System.exit(0);
}
else if(args.length == 1){
System.out.println("Assembly file not given.");
System.out.println("Specification file: " + args[0]);
Syste... | 5 |
private void updateJson() {
//Worlds
List<DynmapWorld> dynmapWorlds = new ArrayList<>();
List<Component> components = new ArrayList<>();
ArrayList<String> addedComponents = new ArrayList<>();
config.setConfighash(0);
String temp = gson.toJson(config);
for (Dynm... | 5 |
public AdaptedRandomDoubles(int count) {
this.count = count;
} | 0 |
public BladesSword(){
this.name = Constants.BLADES_SWORD;
this.attackScore = 11;
this.attackSpeed = 10;
this.money = 300;
} | 0 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
public static int cal(int i, int j, int cur) {
if (min[i][j] != 0)
return min[i][j];
int up, down, left, right;
up = down = left = right = 0;
if (i - 1 >= 0 && m[i][j] < m[i - 1][j])
up = cal(i - 1, j, cur + 1);
if (j - 1 >= 0 && m[i][j] < m[i][j - 1])
left = cal(i, j - 1, cur + 1);
if (i + 1 < row... | 9 |
private boolean isValid(String head) {
if( head.length() > 3 ) return false;
int n = Integer.valueOf( head );
int length = head.length();
if( n >= 100 && n <= 255 ) return true;
if( n >= 10 && n < 100 && length == 2 ) return true;
if( n >= 0 && n <= 9 && length == 1 ) ... | 9 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((sourceName == null) ? 0 : sourceName.hashCode());
return result;
} | 1 |
public UpgradeType getType() {
return type;
} | 0 |
@Override
public double evaluate(int[][] board) {
int max = 0;
int diffCnt = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
max = Math.max(max, board[i][j]);
if (cnt[board[i][j]] == 0) {
... | 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.