text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static AuTerm defaultMap(AuTerm in, Map func) {
if(in instanceof AuMeta) {
return in;
}else if(in instanceof AuVar) {
AuVar term = (AuVar)in;
return mkVarExt(term.getAnnotation(), term.getDepth(),
func.map(term.getType()));
}else if(in instanceof AuPi) {
AuPi term = (AuPi)in;
return mkP... | 8 |
private Expression parsePIConstructor() throws XPathException {
try {
FastStringBuffer pi = new FastStringBuffer(FastStringBuffer.SMALL);
int firstSpace = -1;
while (!pi.toString().endsWith("?>")) {
char c = t.nextChar();
if (firstSpace < 0 && ... | 9 |
public boolean renderBlockVine(Block par1Block, int par2, int par3, int par4)
{
Tessellator var5 = Tessellator.instance;
int var6 = par1Block.getBlockTextureFromSide(0);
if (this.overrideBlockTexture >= 0)
{
var6 = this.overrideBlockTexture;
}
float var7... | 6 |
@Override
public void run() {
ObjectInputStream e = null;
ObjectOutputStream s = null;
try {
e = new ObjectInputStream(entree);
s = new ObjectOutputStream(sortie);
while(!this.Interrupted) {
Commande data = (Commande) ... | 5 |
public void generateView(){
updateVars();
if(pop<1000){
poplabel.setText("Population = "+pop);
}
else if (pop<1000000){
poplabel.setText("Population = "+round2(pop)+"K");
}
else if (pop>=1000000){
poplabel.setText("Population = "+round2(pop)+"M");
}
caplabel.setText("Capital = "+cap);
jobl... | 3 |
public void setTableContents(Object[][] tableContents)
{
int outer = 0;
int inner = 0;
//Get how big each section of the array is
for(int i=0; i<tableContents.length; i++)
{
outer ++;
for (int j=0; j<tableContents[i].length; j++)
{
inner ++;
}
}
//Make a new array and copy the data to ... | 4 |
public static void main(String[] args)
{
HashMap map = new HashMap();
for (int i = 0 ;i <10000; i++){
map.put(new Integer(i),new Integer(i + 100));
}
long startTime=System.currentTimeMillis(); //获取开始时间
Set set = map.entrySet();
for(Iterator iter = set.iterator();iter.hasNext();){
... | 2 |
public static boolean PropertiesFileExists(){
File f = new File("Auto-DDWRT-Backup.properties");
if(f.exists() && !f.isDirectory())
return true;
else
return false;
} | 2 |
protected void onRender(GraphicsHelper gh) {
Line l = new Line(xOnView(pos.x),yOnView(pos.y)+slider.y/2,xOnView(pos.x)+size.x,yOnView(pos.y)+slider.y/2);
gh.g().setColor(pressed ? Color.gray : Color.darkGray);
gh.g().draw(l);
float posX = value/((float)maxValue)*(size.x-slider.x);
Rectangle r = new Rect... | 5 |
public void setPieces(){
OthelloPiece[][] piecesToBeSaved = OthelloBoard.getPieces();
for(int j = 0; j < piecesToBeSaved[0].length; j++){
for(int i = 0; i < piecesToBeSaved.length; i++){
if(piecesToBeSaved[i][j].getPieceColour() == Piece.OthelloPieceColour.BLACK){
Element newBlackPiece;
... | 8 |
public static void main(String[] args) throws FileNotFoundException {
Integer node_id = 0,indexer = 0;
Betweeness betweeness;
ArrayList<Integer> vertexes = new ArrayList<Integer>();
ArrayList<Edge> edges = new ArrayList<Edge>();
file = new FileReader("src/jose.txt");
buffer = n... | 9 |
static final WidgetVariable method3127(int i) {
anInt9395++;
if (i != 2681)
aBoolean9403 = true;
WidgetVariable class348_sub42_sub15
= ((WidgetVariable)
Class367_Sub4.aClass107_7325.getFirst());
if (class348_sub42_sub15 != null) {
class348_sub42_sub15.removeNode();
class348_sub42_sub15.r... | 5 |
private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... | 5 |
public void calcOutputs(double[] inputs, double[] weights, double[] outputs) {
int size = inputs.length;
for (int i = 0; i < size; i++) {
metaArray[i] = inputs[i];
}
int position = size;
size = layers.length;
int prePosition = 0;
int weightsPosition = 0;
int conPosition = weightsNum;
for (int i = 1... | 9 |
public ArrayList<String> returnStoreAddresses() {
ArrayList<String> list = new ArrayList<String>();
int headPointer = head;
while (headPointer <= tail) {
// check if not typo
if (tuples[headPointer].getType().equals("SW"))
list.add(tuples[headPointer].getValue());
headPointer = (headPointer + 1) % si... | 2 |
public int compareTo(Puzzle other) {
int out = 0;
if ((this != null) && (other != null)) {
for (int i = 0; i < this.getHeight(); i++) {
for (int j = 0; j < this.getLength(); j++) {
if (this.getValue(i, j) != other.getValue(i, j)) {
... | 5 |
@Override
public void onStop() throws JFException {
// // 各通貨ペアのティック情報を受信した際に呼ばれます。
// LOGGER.info("onTick");
} | 0 |
private static Double getDouble() {
Boolean flag;
double numDouble = 0.0;
do {
Scanner scanner = new Scanner(System.in);
try {
numDouble = scanner.nextDouble();
flag = true;
} catch (Exception e) {
flag = false;
System.out.println("Input type mismach!");
System.out.print("Please input... | 2 |
private double [][][][] getResEntropyEmatricesPair(String matrixName, ParamSet sParams, int numRes, String strandDefault[][], MolParameters mp,
String runName, double dist){
String origPDB = (String)sParams.getValue("PDBNAME");
//Check for the pairwise rot-to-rot file;
String pairName = matrixName+"_pair... | 7 |
private static boolean hasScheme(String str) {
int len = str.length();
if (len == 0)
return false;
if (!isAlpha(str.charAt(0)))
return false;
for (int i = 1; i < len; i++) {
char c = str.charAt(i);
switch (c) {
case ':':
// Don't recognize single letters as schemes
return... | 8 |
public void standartisation() {
//for each col in data
for (int i = 0; i < datas.get(0).size(); i++) {
List<Double> data = new ArrayList<>();
for (int j = 0; j < datas.size(); j++) {
data.add(datas.get(j).get(i));
}
double mean = getMean(da... | 3 |
private void setMidiDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("starttime"))
midiDef.setStartTime(Integer.valueOf(attrs.getValue(1)));
else if (attrs.getValue(0).equals("endtime"))
midiDef.setEndTime(Integer.valueOf(attrs.getValue(1)));
else if (attrs... | 4 |
public void clearNotUsedBranch() {
if (getLastInstruction() != null
&& getLastInstruction().getOP() == OP.BRA
&& getLastInstruction().getTarget().getSSAVar().getVersion() == this.condNextBlock
.getID() && this.condNextBlock.isDominateBy(this)) {
instructions.remove(instructions.size() - 1);
}
} | 4 |
private static Object parseValue(String value){
if(value.startsWith("[")&&value.endsWith("]")){
return PropParser.parsePropList(value);
}else{
return value;
}
} | 2 |
public void setImage (Image value) {
checkWidget ();
if (value == super.getImage ()) return;
if (value != null && value.equals (super.getImage ())) return; /* same value */
super.setImage (value);
/* An image width change may affect the space available for the column's displayText. */
GC gc = new GC (parent);
... | 9 |
public int testModuleBoolean(String thisNetwork){
String[] genes = thisNetwork.split(":");
HashSet<String> truePatients = new HashSet<String>();
String[] thesePatients;
if (genes[0].equals("none")){
return 2;
}
for (int i=0; i<genes.length; i++){
thesePatients = allGeneSamplesMap.get(genes[i]).... | 7 |
public static void main(final String[] args) {
int p = 0;
String[] paths = new String[2];
boolean ignorePrivateModules = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-i") || args[i].equals("--ignore-private-modules")) {
ignorePrivateModul... | 7 |
public static void experimentRepetitive2(String[] args) {
final String ID = args[0];
ExecutorService exec = Executors.newFixedThreadPool(Runtime
.getRuntime().availableProcessors());
System.out.println("Start with "
+ Runtime.getRuntime().availableProcessors() + " threads");
try {
// test with foll... | 7 |
final public assignOperator_AST Assignment() throws ParseException {
fieldAccess_AST lhs = null;
binaryExpression_AST rhs = null;
assignOperator_AST jjtn001 = new assignOperator_AST(JJTASSIGNOPERATOR_AST);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
lhs = FieldAcce... | 9 |
public String transformDocumentToString(Document document) {
StringWriter sw = new StringWriter();
TransformerFactory tFactory =
TransformerFactory.newInstance();
Transformer transformer = null;
try {
transformer = tFactory.newTransformer();
} catch (T... | 2 |
public final void pitch(double angle) {
if (XAXIS_ANGLE == -angle) {
XAXIS_ANGLE = angle;
XAXIS_TURN.entry[1][2] = -XAXIS_TURN.entry[1][2];
XAXIS_TURN.entry[2][1] = -XAXIS_TURN.entry[2][1];
} else if (XAXIS_ANGLE != angle) {
// Cache it!
XAXIS_ANGLE = angle;
angle = Math.toRadians(angle);
doubl... | 2 |
public void update(double deltaTime){
//if resources available, take them and start production. start timer
//once time is up, produce the resource and repeat the loop
if(!producing){
producing = true;
for(EnumResource resource : inputs){
if(location.getPlanetResource(resource).getQuantity()<=0)//if the... | 6 |
private static long getMillisPerUnit(int unit) {
long result = Long.MAX_VALUE;
switch (unit) {
case Calendar.DAY_OF_YEAR:
case Calendar.DATE:
result = MILLIS_PER_DAY;
break;
case Calendar.HOUR_OF_DAY:
result = MILLIS_PER... | 6 |
public void UsePower(boolean which) {
if (which) {
if (power>=level1&&level1!=0) {
power-=level1;
MyPower1();
}
}
else {
if (power>=level2&&level2!=0) {
power-=level2;
MyPower2();
}
}
} | 5 |
private int processRequest(BankRequest bankRequest) {
/*
if (bankRequest.getUser().getAccountId() >= accounts.size()) {
return; // Can not handle the bankRequest
}
*/
/*
com.bank.Account account = accounts.get(0);
int iterator = 0;
int size =... | 5 |
public final void endDocument() throws SAXException {
try {
os.write(toByteArray());
} catch (IOException ex) {
throw new SAXException(ex.toString(), ex);
}
} | 1 |
public boolean collides(Entity other) {
if (distanceSquared(other) < 2 * radiusSquared)
return true;
else
return false; // we use 50 as radius
} | 1 |
static int getMenuKeyCode() {
String menuKeyStr;
int menuKeyCode = KeyEvent.VK_F8;
menuKeyStr =
Configuration.getParam("menuKey").getValueStr();
for (int i = 0; i < getMenuKeySymbolCount(); i++)
if (menuSymbols[i].name.equals(menuKeyStr))
menuKeyCode = menuSymbols[i].keycode;
r... | 2 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Element selectedElement = (Element) ElList.getSelectedValue();
SetOfAssets elementAssets = new SetOfAssets();
for (int i=0; i<AssList.getSelectedValuesList().size(); i++... | 3 |
public void appendSamples(int channel, float[] f)
{
short s;
for (int i=0; i<32;)
{
s = clip(f[i++]);
append(channel, s);
}
} | 1 |
void passf5(int ido, int l1, final double cc[], double ch[], final double wtable[], int offset, int isign)
/*isign==-1 for forward transform and+1 for backward transform*/
{
final double tr11=0.309016994374947;
final double ti11=0.951056516295154;
final double tr12=-0.809016994374947;... | 4 |
@Override
public Label predict(Instance instance) {
// TODO Auto-generated method stub
if (MathUtilities.innerProduct(linearParam, instance) > 0) {
return new ClassificationLabel(1);
}
return new ClassificationLabel(0);
} | 1 |
@Override
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if (code > 0 && code < keys.length) {
keys[code] = true;
}
} | 2 |
public String read(String name) {
return cookies.get(name);
} | 0 |
@Override
public boolean useItem(Player player, int type)
{
Block block = Block.blocks[type];
if(block == Block.RED_MUSHROOM && minecraft.player.inventory.removeResource(type))
{
player.hurt(null, 3);
return true;
} else if(block == Block.BROWN_MUSHROOM && minecraft.player.inventory.removeResource(type... | 4 |
private void FightBattle(Planet p) {
Map<Integer, Integer> participants = new TreeMap<Integer, Integer>();
participants.put(p.Owner(), p.NumShips());
Iterator<Fleet> it = fleets.iterator();
while (it.hasNext()) {
Fleet f = it.next();
if (f.TurnsRemaining() <= 0 && GetPlanet(f.DestinationPlanet()) == p)... | 8 |
@Override
public List<String> getSuggestions(CommandInvocation invocation)
{
String token = invocation.tokens().get(invocation.tokens().size() - 1);
List<String> list = new ArrayList<>();
if (token.startsWith("-") || token.isEmpty())
{
if (token.startsWith("-"))
... | 5 |
@Override
public boolean equals(Object obj) {
ItemSet itemSet = (ItemSet) obj;// necessary casting
if (this.itemSet.size() == itemSet.getItemSet().size()) {
for (int i = 0; i < this.itemSet.size(); i++) {
if (!this.itemSet.get(i).getItem()
.equals(itemSet.getItemSet().get(i).getItem())) {
return ... | 3 |
Entity(int type,ImageIcon icon) {
this.type = type;
this.icon = icon;
switch (type) {
case WALL:
this.destructable = false;
case BOX:
this.destructable = true;
case PATH:
this.destructable = false;
... | 5 |
public static boolean isPalindrome(ListNode head) throws IllegalArgumentException {
if (head == null) {
throw new IllegalArgumentException();
}
if (head.next == null) {
return true;
}
/* Get middle point of the list */
ListNode ptr1 = head;
ListNode ptr2 = head;
while (ptr2 != null && ptr2.n... | 6 |
public String google(String keyword, String accessToken) {
URL url = null;
String result = null;
JSONObject jObject = null;
URLShortener bitly = null;
if(accessToken != null){
bitly = new URLShortener(accessToken);
}
try {
url = new URI("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&s... | 6 |
public void openWindow(JInternalFrame aWindow, String aTitle, boolean aIsMaximizable, boolean aIsClosable, boolean aIsResizable, boolean aSetCentre, boolean aSetModal) {
if (aSetModal) {
jDesktopPane1.add(aWindow, javax.swing.JLayeredPane.MODAL_LAYER);
} else {
jDes... | 6 |
@Override
public String toString() {
return "FileSearchBean: " + inputFile.toString();
} | 0 |
public Creature(Card c){
super(c.getCardName(), c.getManaCost(), c.getCmc(), c.getColors(), c.getKeywords(), c.getCardText(), "creature");
this.sumSick = true;
this.tapped = false;
String[] keywords = c.getKeywords().split(", ");
for(String s : keywords){
if(s.contains("power"))
this.power = C... | 4 |
public String generate() {
String error = "No errors.";
if (details)
System.out.println("Rivers flags: PRODUCE="+ioflags.PRODUCE+", SAVE="+ioflags.SAVE+", LOAD="+ioflags.LOAD);
if (Utils.flagsCheck(ioflags) != 0) {
System.out.println("ERROR: IOFlags object is corrupted, error: "+Utils.flagsCheck(iofla... | 4 |
@Override
public boolean canImport(TransferSupport support) {
return ((support.getComponent() instanceof JList) &&
(support.isDataFlavorSupported(RosterComponent.ROSTER_COMPONENT_DATA_FLAVOR) ||
support.isDataFlavorSupported(RiverComponent.RIVER_COMPONENT_DATA_FLAVOR) ));
} | 2 |
private boolean mutuallyExclusive(String operator1, String operator2, String type1, String type2){
ConditionAnalyzer conditionAnalyzer = new ConditionAnalyzer();
//Falls die Bedingungen vom Typ Boolean sind
if (type1.equals("Boolean")){
return conditionAnalyzer.typeBoolean(operator1, boolean1, operator2, bo... | 4 |
protected String getPreviousSystemUtterance(String folder, String logLocation, String line, /*new*/ String wavFile) {
int indexLogWord = logLocation.indexOf("log/");
String sessionFile = "";
if (indexLogWord != -1) {
String aux = logLocation.substring(indexLogWord+4);
sessionFile = folder + "/" +aux +... | 8 |
@Test
public void testAdvance() {
//normal values
//x direction only
Ball b = new Ball(250,250,0);
b.advance(100);
assertArrayEquals(new int[]{310,250},b.getPosition());
//y direction only
b.setPosition(250,250,Math.PI/2);
b.advance(100);
assertArrayEquals(new int[]{250,310},b.getPosition());
... | 1 |
int getFreeThreadId() {
for (int i = 0; i < this.clientHandlerThread.length; i++) {
if (this.clientHandlerThread[i] != null && this.clientHandlerThread[i].isAlive())
continue;
else {
this.log.info("get Free Thread Id: " + i);
return i;
}
}
this.log.info("get Free Thread Id: -1");
return -1;... | 3 |
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 int trcg(double delta, double[] g, double[] s, double[] r) {
int n = fun_obj.get_nr_variable();
double one = 1;
double[] d = new double[n];
double[] Hd = new double[n];
double rTr, rnewTrnew, cgtol;
for (int i = 0; i < n; i++) {
s[i] = 0;
... | 5 |
@Override
public boolean actionPieces(Move m, Board b, Player p) {
int originMoveX = m.getOrigin().getX();
int originMoveY = m.getOrigin().getY();
int destinationMoveX = m.getX();
int destinationMoveY = m.getY();
if(destinationMoveX == (originMoveX+2) || destinationMoveX == (originMoveX-2))
{
i... | 5 |
private void resize(int capacity) {
Key[] temp = (Key[]) new Comparable[capacity];
for (int i = 0; i <= N; i++) {
temp[i] = pq[i];
}
this.pq = temp;
} | 1 |
private List<ReducerEstimatedJvmCost> estimateReducersMemory(List<Reducer> eReducers, InitialJvmCapacity gcCap) {
int fReducerNum = finishedConf.getMapred_reduce_tasks();
if(fReducerNum == 0)
return null;
List<ReducerEstimatedJvmCost> reducersJvmCostList = new ArrayList<ReducerEstimatedJvmCost>();
Re... | 4 |
static boolean testScalar( Object val) {
boolean bres = false;
if (val != null
&& (val instanceof Byte
|| val instanceof Short
|| val instanceof Integer
|| val instanceof Long
|| val instanceof Float
|| val instanceof Double
|| val instanceof Character
|| val instanceof... | 9 |
protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) {
if (section instanceof MemorySection) {
MemorySection sec = (MemorySection) section;
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
output.add(createPath(sectio... | 5 |
public List<Method> getMListeners(Class<?> l1, Class<?> l2){
//L1 == object, L1 == Listener
List<Method> methods = new ArrayList<Method>();
for(Method m: l2.getDeclaredMethods()){
if(m.isAnnotationPresent(EventHandler.class)){
if(m.getParameterTypes().length == 1){
if(m.getParameterTypes()[0].eq... | 6 |
public ArrayList<Auction> searchWinnerByKeyword(String keyword,
String winner) {
try {
ArrayList<Auction> auctions = new ArrayList<Auction>();
String[] keywords = keyword.split(" ");
String[] usernames = winner.split(" ");
String sql = "select * from (select * from " + tableName
+ " where ";
fo... | 7 |
public static void setLogFile(String logFile, String className) {
try {
Logger logger = Logger.getLogger(className);
FileHandler fileTxt = new FileHandler(logFile);
java.util.logging.Formatter formatterTxt = new SimpleFormatter();
fileTxt.setFormatter(formatterTxt);
logger.addHandler(f... | 1 |
public int esIgual(Compra c) {
if (this.id-c.id==0 && this.cantidad==c.cantidad && this.concepto.equals(c.concepto)) {
return 0;
}else{
return 1;
}
} | 3 |
public static void main(String... args) {
Logger.log("Starting...");
DB.initDB();
for (Crawler c : DiskAccess.readTrackerList())
c.start();
// For debugging purpose the program ends after some time
if (args.length == 1 && args[0].equals("-d")) {
try {
Thread.sleep(20*1000);
... | 4 |
public String readLine(PushbackReader in, boolean keepWhiteSpace)throws IOException {
StringBuffer buffer = new StringBuffer();
int EOF = -1;
int c;
c = in.read();
while (c != EOF && c != '\n' && c != '\r') {
if (!isWhite(c) || keepWhiteSpace) {
... | 7 |
public final void run() {
try {
printJump("" + booster);
String s = Utils.getString("guild_challenge/index");
int i = s.indexOf("var flashvars = {");
i = s.indexOf("var flashvars = {", i + 1);
i = s.indexOf("var flashvars = {", i + 1);
s = s.substring(s.indexOf("guild_id:", i + 1));
s = s.substr... | 4 |
private boolean test_seed(RandomNumberGenerator generator)
{
int[] first_sequence = new int[10000];
generator.set_seed(0);
for (int i = 0; i < 10000; i++)
{
first_sequence[i] = generator.next_int(10000);
}
int[] second_sequence = new int[10000];
generator.set_seed(0);
for (int i... | 4 |
public static void aggiorna(int termina) { // aggiorna la grafica
for(int i=0; i < 8; i++)
for(int j=0; j < 8; j++)
bottoni[i][j].aggiorna(damiera, i, j);
FinestraDama.aggiungiPedine(12-damiera.getNumeroPedine()[0], 12-damiera.getNumeroPedine()[1]); // passa i nuovi valori delle ... | 2 |
public static String mapToString(Map<String,Object> toSend) {
String key = null;
Object object = null;
JsonObjectBuilder dataContainer = Json.createObjectBuilder();
for(Map.Entry<String,Object> entry: toSend.entrySet()){
key = entry.getKey();
object = toSend.get(e... | 5 |
public MyCustomEventApplicationEventPublisher() {
applicationEventPublisher = null;
} | 0 |
private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
int c1, c2;
if (len <= 0 || len > d.length)
throw new IllegalArgumentException ("Invalid len");
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_co... | 5 |
public static double calculateChiSquare(Model model, String featureA, String featureB, String splitChar) {
if (model.getFeatureValueFrequency().get(featureA + splitChar + featureB) == null) {
System.out.println("feature key \"" + featureA + splitChar + featureB + "\" not found in model. wrong order of feature keys... | 7 |
private static int
g_numdays(int month,
int year)
{
int y;
y = Math.abs(year);
/* Compute the last date of the month for the Gregorian calendar. */
switch (month)
{
case 2:
if ( (((y % 4) == 0) && ((y % 100) != 0)) || ((y % 400) == 0) )
return(29);
else
return(28);... | 8 |
public String getPostalAddress() {
return postalAddress;
} | 0 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if(txtUsuario.getText().isEmpty()){
JOptionPane.showMessageDialog(rootPane,"Campo Usuário Vazio !");
}
else if(pswSenha.getText().isEmpty()){
JOptionPane.showMe... | 5 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("Profil Post");
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
Personne loguedPerson = new Personne();
loguedPerson=(Personne) httpServletRequest.getSe... | 8 |
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
/**
* Servlet vastaanottaa Menu-sivulta ostoskoriin lisättävän tuotteen
* (pizzan tai juoman) tiedot ja luo niistä Tilausrivi-luokan olion.
* Olio lisätään saman luokan olioita sisältävä... | 3 |
public static int indexOf(byte[] data, byte[] pattern) {
int[] failure = computeFailure(pattern);
int j = 0;
for (int i = 0; i < data.length; i++) {
while (j > 0 && pattern[j] != data[i]) {
j = failure[j - 1];
}
if (pattern[j] == data[i]) {
... | 5 |
void save(GameLeagueFile xmlFile) {
int nofMatchs;
if ((m_nofTeams % 2) == 0) {
nofMatchs = m_nofDiv * m_nofTeams / 2;
} else {
nofMatchs = m_nofDiv * (m_nofTeams + 1) / 2;
}
xmlFile.writeSurroundingStartElement("Schedule");
for (int i = 0; i < m_nofRounds; i++) {
xmlFile.writeSurroundingStartEleme... | 9 |
public static Integer stoInteger(String str){
Integer i=0;
if(str!=null){
try{
i = Integer.parseInt(str.trim());
}catch(Exception e){
i = null;
}
}else{
i = null;
}
return i;
} | 2 |
public void copy(int[] src, int[] dst) {
int smallest_size = Math.min(dst.length, src.length);
for (int i=0; i<smallest_size; i++) {
dst[i] = src[i];
}
if (dst.length > src.length) {
for (int i=smallest_size; i<dst.length; i++) {
... | 3 |
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 static COMMAND_TYPE determineCommand(String command) {
if (command.equals("add")) {
return COMMAND_TYPE.ADD_EVENT;
} else if (command.equals("delete")) {
return COMMAND_TYPE.DELETE_EVENT;
} else if (command.equals("display")) {
return COMMAND_TYPE.DISPLAY_EVENTS;
} else if (command.equals("clea... | 7 |
public PlayerPane(){
super("playerpane");
allowsMapInteraction = true;
linksTo = Boot.getPlayer();
int j = 0;
int k = 0;
int l = -1;
for (int i = 0; i < PlayerInfo.INVENTORYSIZE; i++){
if (i % 4 == 0 && i != 0){
k = 0;
j++;
}
if (i % 12 == 0){
l++;
}
addSlot(new GUISlot((k... | 4 |
protected void executeCommandLine(Commandline commandLine)
throws CommandLineException, MojoExecutionException {
getLog().info("Executing command: " + commandLine.toString());
CommandLineUtils.StringStreamConsumer systemErr = new CommandLineUtils.StringStreamConsumer();
CommandLineUtils.StringStreamConsumer sy... | 5 |
public static void javaOutputCase(Cons renamed_Case) {
{ Stella_Object keyform = renamed_Case.value;
Stella_Object defaultcase = renamed_Case.rest.value;
Stella_Object conditions = renamed_Case.rest.rest.value;
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("switch (");
... | 6 |
public void renderPlayer(int xp, int yp, Sprite sprite) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < 32; y++) {
int ya = y + yp;
for (int x = 0; x < 32; x++) {
int xa = x + xp;
if (xa < -16 || xa >= width || ya < 0 || ya >= height)
break;
if (xa < 0)
xa = 0;
int col = sprite... | 8 |
public TreeNode[] getSelected() {
return (TreeNode[]) selectedNodes.keySet().toArray(new TreeNode[0]);
} | 0 |
@Test
public void orderingGuarantees()
throws Exception {
for( String outer: GOODIBANS ) {
for( String inner: GOODIBANS ) {
final IBAN o = IBAN.valueOf(outer);
final IBAN i = IBAN.valueOf(inner);
final int d1 = compare(o, i);
final int d2 = compare(o.toString(), i.toString());
... | 7 |
public ManualAssignList(final List<Student> students, List<Timeslot> timeslots, final GUI gui) {
super("Students to Manually Assign " + (timeslots.get(0) instanceof Lab? "Labs":"Tuts"));
this.setLayout(new BorderLayout());
UIDefaults ui = UIManager.getLookAndFeel().getDefaults();
UIManager.put("RadioButton.focu... | 8 |
public PossibleConnection engageIgnoringParagraphs(int i) {
/* Inicijalizacija */
// Slucaj spoja
mostProbable11.setconnectionCase(11);
// Pretpostavimo da je to nemoguc spoj
mostProbable11.setProbability(0.0);
// Ocistimo listu elemenata koji bi se ovim spojem spojili
mostProbable11.getk... | 5 |
@Override
public int hashCode() {
int result = tagName.hashCode();
result = 31 * result + (isBlock ? 1 : 0);
result = 31 * result + (formatAsBlock ? 1 : 0);
result = 31 * result + (canContainBlock ? 1 : 0);
result = 31 * result + (canContainInline ? 1 : 0);
result = 3... | 9 |
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.