text stringlengths 14 410k | label int32 0 9 |
|---|---|
private byte[] readData(FormatConverter converter, InputStream inputStream, LodResource lodResource) throws IOException {
int length = 64;
InputStream convertedInputStream = null;
byte[] data = null;
if (null == converter)
{
convertedInputStrea... | 7 |
@Override
public String getOptionsXML()
{
StringBuffer sb = new StringBuffer();
if( pcBubbleSizeRatio != 100 )
{
sb.append( " BubbleSizeRatio=\"" + pcBubbleSizeRatio + "\"" );
}
if( wBubbleSize != 1 )
{
sb.append( " BubbleSize=\"" + wBubbleSize + "\"" );
}
if( fShowNegBubbles )
{
sb.append(... | 4 |
public static void setResolution(PrintRequestAttributeSet set, PrinterResolution resolution) {
if (resolution != null) {
set.add(resolution);
} else {
set.remove(PrinterResolution.class);
}
} | 1 |
public void processMessage(String stream, String message, int attemptNo){
// System.out.println("Message arrived" + stream + ":" + message);
long locked = 0;
String gameid = null;
String gameconf = null;
try{
JSONObject jobj = JSONObject.fromObject(message);
gameid = String.valueOf(jobj.get("gameid"));
... | 8 |
public boolean checkForRoundCompletion(Player player,List<Player> players) {
if(getTotalActivePlayerInThisRound(players)==1){
return true;
}else if ( isRaiseHappened && player == playerWhoRaisedInthisRound) {
return true;
}else if (!isRaiseHappened && isBetPlaced && player==playerPlacedTheBet){
return t... | 9 |
void onEntityChanged( final long someEntityId ) {
//setup local variables
List<Class<? extends Data>> processorInterstedDataList;
long processorIdBuffer;
boolean isInterested;
int interestedProcessorCount;
//retrieve all processors and a list with interested enti... | 8 |
public void setDefaults() {
System.out.println("[BurningCS] Setting default config values");
try {
new File(this.dir).mkdir();
this.configFile.delete();
this.configFile.createNewFile();
} catch (Exception e) {
System.out.println("[BurningCS] Could ... | 2 |
@Override
public void createFrom(int elementIndex, int numberOfPoints){
int size = 0;
for(int i = 0; i<numberOfPoints; i++){
size = size + inData.getLength()/numberOfPoints;
Integer[] array = new Integer[size];
for(int j = 0; j < size; j++ ){
array... | 2 |
public void tick() {
if (isHit) {
return;
}
if (tickCount == 0) {
switch(dir) {
case LEFT:
dx += -speed;
break;
case RIGHT:
dx += speed;
break;
... | 6 |
private FormData readFormData_multiPartFormData( String param_contentType,
HeaderParams headerParams )
throws IOException,
HeaderFormatException,
DataFormatException,
UnsupportedFormatException {
// The content type header should look like something like this:
// Content-Type: m... | 7 |
private boolean checkForAttributes(File dataFile) {
try {
m_fileScan = new Scanner(dataFile);
} catch (FileNotFoundException e) {
return false;
}
m_delimiter=",";
m_lineScanner= new Scanner(m_fileScan.nextLine());
m_lineScanner.useDelimiter(m_delimiter);... | 3 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
@Override
public void updateThisPlayerMovement(Player player, ByteVector packet) {
if (player.getUpdateFlags().contains("teleporting") || player.getUpdateFlags().contains("map-region")) {
packet.writeBits(1, 1);
packet.writeBits(2, 3);
packet.writeBits(2, player.getPosition().getPlane());
packet.writeBit... | 8 |
@Before
public void setUp() throws Exception {
String[] moments = {
"01/01/2014 11:11","01/01/2014 11:28",
"01/01/2014 11:29","01/01/2014 12:08",
"01/01/2014 12:14","01/01/2014 12:42",
"01/01/2014 13:37","01/01/2014 14:17",
"01/01/2014 14:20","01/01/2014 14:23",
... | 1 |
public int run(String[] args) throws Exception {
if (args.length != 5) {
System.err.println("Usage: Model <input path> " +
"<output path for neuron structure>" +
"<output path for firing extraction>" +
"<output path for membrane potential>" +
"<output path for recovery variable>");
System.e... | 8 |
private boolean createDom(Section odMLRoot, boolean asTerminology) {
logger.debug("in createDom\twith RootSection");
doc = new Document();
// create processing instruction the last one added is the preferred one
ProcessingInstruction instr = null;
ProcessingInstruction altInstr =... | 8 |
public void setOsoba(Osoba osoba) {
this.osoba = osoba;
} | 0 |
@Override
public void startElement(String uri, String localName, String qName,
org.xml.sax.Attributes attributes) throws SAXException {
tag = Tags.fromString(qName);
if (tag == null) {
return;
}
switch (tag) {
case MESSAGE:
String tmp = attributes.getValue("id").trim();
int bid = Integer.parseIn... | 2 |
private static void addRandomPit(WorldMap w, Random r)
{
boolean valid = false;
while (!valid)
{
int x = rnd(r);
int y = rnd(r);
if (!(x == 1 && y == 1) && !w.hasPit(x, y))
{
valid = true;
w.addPit(x, y);
... | 4 |
public void add(String word) {
if (word.trim().length() > 0)
m_Words.add(word.trim().toLowerCase());
} | 1 |
void readToData(boolean returnOnYield)
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
case 'Y':
server.freeReadLock();
if (returnOnYield)
return;... | 7 |
public static void open(File root)
{
System.out.println("Loading cache from " + root + "...");
System.out.println("----------------------------------");
try
{
File file = new File(root, "main_file_cache.dat");
datum = new RandomAccessFile(file, "rw").getChannel();
System.out.println("\tCache found " +... | 6 |
public static void markRowColumn(int[][] input) {
boolean[] row = new boolean[input.length];
boolean[] column = new boolean [input[0].length];
for (int i = 0; i < input.length; i++) {
for (int j = 0; j < input[0].length; j++) {
if(input[i][j] ==1){
... | 9 |
public static void execute() throws Exception{
//creating final dict and dir
File dictFile = new File("dict/final/final.dict");
dictFile.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(dictFile);
OutputStreamWriter finalDictWriter = new OutputStreamWriter(fos);
//list of ea... | 8 |
private ArrayList<String> compileAssignment(String varname, String value) throws MCCAssignmentException {
if (!vars.containsKey(varname)) throw new MCCAssignmentException();
ArrayList<String> out = new ArrayList<String>();
Variable targetVar = vars.get(varname);
boolean byVar = false;
if (value == "false" || ... | 9 |
private void display() {
num = getArray();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.print(num[i][j] + " ");
}
System.out.println();
}
} | 2 |
public void setId(Long id) {
this.id = id;
} | 0 |
private Node parseRange() {
if (input.charAt(offset) == '^') {
throwError("Negotiated ranges are forbidden");
}
Decision result = new Decision(this);
while (offset < input.length()) {
char from = input.charAt(offset);
if (from == ']') {
offset++;
break;
}
char sep = input.charAt(of... | 6 |
public int getHeight() {
return height;
} | 0 |
public void setNick(String nick){ this.Nick = nick; } | 0 |
@Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.PARAGRAPH);
Pattern sentencePattern = Pattern.compile(SENT... | 3 |
@Override
public void reduce(DoubleTextPair key, Iterable<Text> values, Context context) throws IOException,
InterruptedException {
String tmp;
List<String> fk = new ArrayList<String>();
List<String> pk = new ArrayList<String>();
for (Text v : values) {
tmp = v.toString();
// FIXLATER 只有支援一個表格一個顯示欄位... | 8 |
public ArrayList<String> splitInput(String input) {
boolean quote = false;
int index = 0;
ArrayList<String> sentences = new ArrayList<>();
for (int i = 0; i < input.length(); i++) {
if (input.substring(i, i + 1).equals("\"")) {
quote = !quote;
}
... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CvOutlet other = (CvOutlet) obj;
if (!Objects.equals(this.Outlet, other.Outlet)) {
return fal... | 3 |
public PGM affichage(){
PGM img = new PGM(255, valeurs.length*5, this.getMaxValeurs());
ArrayList<Integer> list = new ArrayList<>();
for(int i = this.getMaxValeurs(); i > 0; i--){
for (int j = 0; j < valeurs.length; j++){
if (valeurs[j] >= i){
... | 3 |
public void addContent(String path, File pContent) {
if (pContent.isFile()) {
if (pContent.getName().endsWith(EXT_XCS)) {
addConfigurationSchemaFile(path);
} else if (pContent.getName().endsWith(EXT_XCU)) {
addConfigurationDataFile(path);
} els... | 7 |
public void testPropertyAddHour() {
Partial test = new Partial(TYPES, VALUES);
Partial copy = test.property(DateTimeFieldType.hourOfDay()).addToCopy(9);
check(test, 10, 20, 30, 40);
check(copy, 19, 20, 30, 40);
copy = test.property(DateTimeFieldType.hourOfDay()).addToCop... | 2 |
public static void setSessionId(URLConnection con,String value){
con.setRequestProperty("Cookie", value);
} | 0 |
private static void inOrderTraversal(Node root) {
if (root == null)
return;
inOrderTraversal(root.left);
System.out.println(root.v);
inOrderTraversal(root.right);
} | 1 |
@Override
public SignalAspect getSignalAspect() {
if (isWaitingForRetest() || isBeingPaired()) {
return SignalAspect.BLINK_YELLOW;
}
if (!isPaired()) {
return SignalAspect.BLINK_RED;
}
SignalAspect aspect = SignalAspect.GREEN;
for (WorldCoordin... | 4 |
public static int getSinglePrice(final int ids) {
String add = "http://scriptwith.us/api/?return=text&item=" + ids;
try {
final BufferedReader in = new BufferedReader(new InputStreamReader(new URL(add).openConnection().getInputStream()));
final String line = in.readLine();
in.close();
final String[] set... | 2 |
public static void run_spell_check(File dic, File doc, String option)
{
// Creating a new SpellCheckerUtil object with the dictionary file
SpellCheckUtil mySC = new SpellCheckUtil(dic);
// Creating a list of misspelled words after checking spellcheking the document
List<String> misspelledWords = mySC.spellC... | 6 |
@Override
public Ranking<Candidate> vote() {
Map<LinkedList<Candidate>, Integer> dg = getDirectedGraph();
Candidate winner = null;
Integer score = -1;
// argmin(max(score(Y,X))) =-> winner
// X Y
for (Candidate X : cans)
{
i... | 8 |
@Override
public boolean equals(Object obj) {
if (obj != null) {
if (obj instanceof Node) {
Node n = (Node)obj;
if (n.getId() != null && this.getId() != null
&& n.getId().equals(this.getId())) {
return true;
}
} else if (obj instanceof String) {
String s = (String)obj;
if (this.... | 8 |
public static final boolean isPrime(int n) {
for (int i = 2; i < n; i++) {
if (n % i == 0) {
return false;
}
}
return true;
} | 2 |
@Test
public void delMinReturnsValuesInCorrectOrderWhenInputIsGivenInDescendingOrder() {
int[] expected = new int[100];
for (int i = 99; i >= 0; i--) {
h.insert(new Vertex(0, i));
expected[i] = i;
}
Arrays.sort(expected);
int[] actual = new int[100];
... | 2 |
public void refine() {
List<Component> usedComponentsEP = getNecessaryComponents(bestSequenceAlternativesEnergyPoint);
List<Component> usedComponentsW = getNecessaryComponents(bestSequenceAlternativesWatt);
for (Component component : usedComponentsEP) {
for (DeployedComponent deployedComponent : deploymentAlte... | 6 |
public static Object[] getWFIPath(mxAnalysisGraph aGraph, ArrayList<Object[][]> FWIresult, Object startVertex, Object targetVertex)
throws StructuralException
{
Object[][] dist = FWIresult.get(0);
Object[][] paths = FWIresult.get(1);
ArrayList<Object> result = null;
if (aGraph == null || paths == null || s... | 9 |
public static int[] bubble(int[] array) {
if(array==null || array.length==0) return array;
int tmp;
int cnt=0;
for(int i=0;i<array.length;++i) {
for(int j=0;j<array.length-i-1;++j) {
if(array[j]>array[j+1]) {
cnt++;
tmp = array[j];
array[j] = array[j+1];
array[j+1] = tmp;
}
}
... | 5 |
private boolean _jspx_meth_c_when_0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_choose_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:when
org.apache.taglibs.standard.tag.rt.core.WhenTag _jsp... | 4 |
@Override
public boolean equals(Object o) {
if (!(o instanceof Tuple))
return false;
Tuple oo = (Tuple)o;
if( oo.arg1_type.length() != this.arg1_type.length() )
return false;
if( oo.relation.length() != this.relation.length() )
return false;
if... | 7 |
public boolean isVisible(User user) {
if(visibility == VISIBILITY_PUBLIC) {
return true;
}
if(visibility == VISIBILITY_FRIENDS) {
if(owner.friendsWith(user)) {
return true;
}
}
if(visibility == VISIBILITY_PRIVATE) {
... | 5 |
@Override
protected void mouseClicked(int var1, int var2, int var3) {
if (var3 == 0) {
if (this.mc.ingameGUI.field_933_a != null) {
if (this.message.length() > 0 && !this.message.endsWith(" ")) {
this.message = this.message + " ";
}
... | 5 |
public void testGetDurationMillis_Object2() throws Exception {
try {
StringConverter.INSTANCE.getDurationMillis("P2Y6M9DXYZ");
fail();
} catch (IllegalArgumentException ex) {}
try {
StringConverter.INSTANCE.getDurationMillis("PTS");
fail();
... | 9 |
@Override
public List<ModelLoader> convert(Text[] texts) {
List<ModelLoader> modelList = new LinkedList<>();
for (Text text : texts) {
totalIndex = 0;
ModelLoader model = new ModelLoader();
model.texture = text.font.getAtlas();
// List of bounds of chars in graphicsfont
Rectangle[] allBounds =... | 5 |
public void playfile() {
FileInputStream in;
String path = mp3list.getSong().getPath();
if (!path.equals("")) {
try {
in = new FileInputStream(path);
if (player != null) {
player.close();
};
player = new Player(in);
markPlaying();
setLivePanel();
... | 6 |
public static Hand FullHouse(Rank tripsRank, Rank pairRank) {
return new Hand(HandRank.FullHouse, null, tripsRank, pairRank, Rank.Null, Rank.Null, Rank.Null);
} | 0 |
Vector<Integer> sortIntegers(int a, int b, int c) {
Vector<Integer> result = new Vector<>(3);
if ((a <= b) && (a <= c)) {
result.add(a);
if (b <= c) {
result.add(b);
result.add(c);
} else {
result.add(c);
... | 6 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ObjectID2IntgerMain window = new ObjectID2IntgerMain();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
@Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... | 8 |
public void discoveryTransfer()
{
if(fileManager.getPrevNode().equals(fileManager.getNextNode())) //When second node is connected to the network, all files on this system need to be replicated
{
fileReplicationTransfer(fileManager.getOwnedFiles());
}
else
{
for(FileProperties f : fileManager.getOwnedO... | 9 |
public void repaintGrid() {
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
gridCells[i][j].repaint();
}
}
} | 2 |
public CheckResultMessage check2(int day) {
BigDecimal a1 = new BigDecimal(0);
int r1 = get(6, 5);
int c1 = get(7, 5);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
a1 = getValue(r1 + day, c1 + 1, 1).add(
getValue(r1 + day, c1 + 2, 1)... | 5 |
public void populateWithNatives(int tribeID) {
float meadowed = (1 + totalFertility) / 2f ;
final int
numMajorHuts = (int) ((meadowed * numMajor) + 0.5f),
numMinorHuts = (int) ((meadowed * numMinor) + 0.5f) ;
I.say("Major/minor huts: "+numMajorHuts+"/"+numMinorHuts) ;
final Base base = ... | 5 |
public MyList findTwoTilesMoves(String player) {
// Check if player is valid (so we don't have to worry about
// null pointers later).
if (player == null || ! (player.equals("red") ||
player.equals("blue")))
return null;
MyList moves = new MyList();
// Itera... | 5 |
private Page getPagePotentiallyNotInitedByRecursiveIndex(int globalIndex) {
int globalIndexSoFar = 0;
int numLocalKids = kidsPageAndPages.size();
for (int i = 0; i < numLocalKids; i++) {
Object pageOrPages = getPageOrPagesPotentiallyNotInitedFromReferenceAt(i);
if (pageOr... | 6 |
public void printGrid()
{
for (int i = 0; i < grid.length; i++)
{
for (int j = 0; j < grid[i].length; j++)
{
if (grid[i][j] != null)
System.out.print(grid[i][j].getActive() + " " + i + " " + j);
}
System.out.println();
}
System.out.println();
System.out.println();
} | 3 |
public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject jo = new JSONObject();
JSONTokener x = new JSONTokener(string);
while (x.more()) {
String name = Cookie.unescape(x.nextTo('='));
x.next('=');
jo.put(name, Cookie.unescape(x.... | 1 |
public Image getPlayerImage(){
StringBuilder playerImg;
switch(facingDirection){
case EAST:
playerImg = new StringBuilder("playerEast");
break;
case NORTH:
playerImg = new StringBuilder("playerNorth");
break;
case SOUTH:
playerImg = new StringBuilder("playerSouth");
break;
case WEST:
pl... | 6 |
@Override
public void setJarName(String jarName) {
this.jarName = jarName;
} | 0 |
private void createTextStyleAttributes(VariableMap varMap) {
//Dynamic
if (schemaParser != null) {
Map<String, VariableMap> typeAttrTemplates = schemaParser.getTypeAttributeTemplates();
if (typeAttrTemplates != null) {
String schemaTypeName = "TextStyleType";
//varMap.setType(schemaTypeName);
Var... | 6 |
public static void handleAway(String reason) {
if ( reason.isEmpty() )
reason = "Prostě se flákam.";
getCurrentServerTab().getConnection().setAway(reason);
clearInput();
} | 1 |
public String multiply(String num1, String num2) {
if (num1 == null || num1.length() == 0
|| num2 == null || num2.length() == 0
|| num1.equals("0") || num2.equals("0")) {
return "0";
}
int[] res = mult(num1.toCharArray(), num2.toCharArray());
S... | 9 |
public static final String getLevelString(final int level) {
switch(level) {
case SyslogConstants.LEVEL_DEBUG: return "DEBUG";
case SyslogConstants.LEVEL_INFO: return "INFO";
case SyslogConstants.LEVEL_NOTICE: return "NOTICE";
case SyslogConstants.LEVEL_WARN: return "WARN";
case SyslogConstants.LEVEL_E... | 8 |
public String listWikis() {
String list = "Available wikis: ";
Set<String> wikiNames = this.wikis.keySet();
if (wikiNames.isEmpty()) {
return "(No wikis are available right now.)";
}
for (String wikiName : this.wikis.keySet()) {
list += wikiName + ", ";
}
return list.substring(0, list.lengt... | 2 |
public double cg(double delta) {
int n = model.getNumberOfAtoms();
if (n <= 1)
return -1.0;
if (congvxAtLastStep == null || congvyAtLastStep == null)
initCongArrays();
double potential = 0.0;
double scalar = 1.0;
double sumgrad = 0.0;
double tempx = 0.0, tempy = 0.0;
for (int i = 0; i < n; i++)
... | 7 |
public boolean isSlaComplient(Long timeUnits){
if(this.sla == null){
throw new AutomatonException("no Service Level Agreement defined");
}
return isTimeComplient(timeUnits) && isRateComplient(timeUnits) && isProbabilityComplient() && isTimeComplient(timeUnits);
} | 4 |
@Override
public void mouseExited(MouseEvent e) {
try {
setImg(ImageIO.read(new File("img/button/button.png")));
} catch (IOException ex) {
ex.printStackTrace();
}
} | 1 |
public Object[][] getCells() {
int i;
int n;
Vector<Object[]> result;
Object[] row;
int rowCount;
boolean proceed;
initialize();
result = new Vector<Object[]>();
try {
// do know the number of rows?
rowCount = getRowCount();
if (rowCount == -1)... | 9 |
public int compareTo(Point2D that) {
if (this.y < that.y) return -1;
if (this.y > that.y) return +1;
if (this.x < that.x) return -1;
if (this.x > that.x) return +1;
return 0;
} | 4 |
@Override
public void run() {
try{
Random rnd=new Random();
while(true)
{
Integer item=scheduledQueue.retrieveItem();
if(item==null){
//There is nothing to consume , producer is too slow or even dead
... | 4 |
public String getRoomText(){
if (currentRoom==RoomState.BLOOD)
return "Blood!";
else if (currentRoom==RoomState.EMPTY)
return "Nothing in this room...";
else if (currentRoom==RoomState.GOOP)
return "There's goop on the ground!";
else if (currentRoom==RoomState.PIT)
return "You fell to your doom!";
... | 6 |
public void close() throws IOException {
if (br != null) {
br.close();
br = null;
}
} | 1 |
public JetrisGrid(final Point dimension) {
super(dimension, TETRIS_GRID_BACKGROUND_COLOR, TETRIS_GRID_EMPTY_BORDER);
setPreferredSize(new Dimension(10*CELL_H, 25*CELL_H));
lines = 0;
score = 0;
level = 1;
try{
hiScores = HiScore.load(DAT_FILE);
... | 3 |
@Override
public void keyPressed(KeyEvent e) {
keys[e.getKeyCode()] = true;
} | 0 |
public JButton getjButtonNext() {
return jButtonNext;
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Room targetR=mob.location();
if(targetR==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
int chance=0;
if((mob.location().domainType()&Ro... | 7 |
private <V, E> void testMapping(final JGraphXAdapter<V, E> graph) {
// Edges
HashMap<mxICell, E> cellToEdgeMap = graph.getCellToEdgeMap();
HashMap<E, mxICell> edgeToCellMap = graph.getEdgeToCellMap();
// Test for null
if (cellToEdgeMap == null) {
fail("GetCellToEdge... | 8 |
public void setFinishedById(Integer id, boolean isFinished) {
String query = "update Task set isFinished = :isFinished where id = :taskId";
sessionFactory.getCurrentSession().createQuery(query)
.setInteger("taskId", id)
.setBoolean("isFinished", isFinished)
... | 0 |
public static Integer GetBinaryValue(int length, String string)
{
if(string.length() != length)
{
System.out.println("LENGHT != STRING SIZE");
return 1 / 0;
}
if(length % 2 != 0)
{
System.out.println("LENGTH % 2 IS NOT 0");
return 1 / 0;
}
Character[] chars = StringToCharArray(string);
for(... | 7 |
@Override
public void undo(UndoQueueEvent e) {
if (e.getDocument() == Outliner.documents.getMostRecentDocumentTouched()) {
calculateEnabledState(e.getDocument());
}
} | 1 |
@Override
public void insert(Card data) {
Node<Card> currNode;
Node<Card> prevNode;
Node<Card> aNode = new Node<Card>(data);
if (head == null) {
head = aNode;
head.setData(data);
} else {
currNode = head;
prevNode = head;
// loop till you find the right place
while (currNode != null && da... | 6 |
public static void main(String[] args){
long max_p = 0;
long max_triangle = 0;
for(int p = 12; p <= 1000; p++){
int triangle_count = 0;
for(int c = (3 / p); c <= p; c++){
for(int a = 3; a <= (p - c) / 2; a++){
int b = p - c - a;
if(Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)){
Sy... | 5 |
public void combineTwoFiles() {
try {
//make a temporal file to contain both index txt file and memory hashmap
File newFile = new File(TEMPORAL_FILEPATH);
//if the file doesn't exist, make a new file
if (!newFile.exists()) {
newFile.createNewFile();
}
//make FileWrite and BufferedWri... | 8 |
static private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
cas... | 8 |
public NO findLeading( String name ) {
/*
OBS experimentell metod
klarar inmatning typ "bevä" som ger Beväringsgatan
man måste mata in tillräckligt många tecken för att det skall vara
ett unikt namn (och trycka return)
detta är dyrbart och inte optimalt så använd den inte i onödan
tex inte när du ... | 8 |
@Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (kirjaudutaankoUlos(request)) {
kirjauduUlos(request, response);
} else if (... | 6 |
private void updateEnemyPositions() {
nextRow = 0;
for(int i = 0; i < enemys.length; i++) {
for(int j = 0; j < enemys[i].length; j++) {
if(!enemys[i][j].isAlive()) {
continue;
}
//Update all positions and if one reaches the bound the variable is set
nextRow |= enemys[i][j].move(ENEMY_MOVEMEN... | 7 |
@Override
public String toString() {
String name = getName();
String append = "";
if(name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Byte" + append + ": " + value;
} | 2 |
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("CLICKED");
if(!isClicked){
for(Rectangle rec : Rectangle.moveList){
if (rec.isIn(e.getX(),e.getY()) && (rec instanceof Field)){
isClicked = true;
... | 4 |
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.