text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void doRequest() throws IOException, InterruptedException, ClassNotFoundException {
//for now, just assign work to the nodes with the files needed
int rep = Integer.parseInt(fSystem.filesystem_config.get("replication_factor"));
MapRequest mr = requests.get(0);
int fileLines = fSystem.getFileLineNum... | 7 |
public static void main(String[] args) {
try {
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
for (int idx = 0; idx < installedLookAndFeels.length; idx++) {
if ("Nimbus".equals(installedLookAndFeels[idx].getName())) {
... | 6 |
@Test
public void testCourse() {
// test each student
for (IPlace[] row : course.getStudents()) {
for (IPlace is : row) {
if (is instanceof Student) {
Student s = (Student) is;
for (int i = 0; i < s.getActualState().size(); i++) { // check correct actual state and change vector
if (s.getActu... | 8 |
public void setVale(double vale) {
this.vale = vale;
} | 0 |
public void resetRelation()
{
if(startBtn.getX()+startBtn.getWidth() < endBtn.getX())
{
double separation = (endBtn.getX()-(startBtn.getX()+startBtn.getWidth()))*App.currentDistance/20;
relDialog.relDesc.min = 0.0;
relDialog.relDesc.max = separation;
relDialog.relDesc.rel = RelationType.BEFORE;
r... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Option option = (Option) o;
if (idoption != option.idoption) return false;
if (surveyIdsurvey != option.surveyIdsurvey) return false;
i... | 9 |
String downloadURL() {
String line, result = null;
int code = 200;
boolean first = true;
do {
if (first) {
first = false;
} else {
sleep(1000);
}
try {
result = "";
URL url = formURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty... | 8 |
public boolean inside(int x, int y) {
if (type == TYPE_RECT) {
if (rect.contains(x,y)) return true;
} else if (type == TYPE_CIRCLE) {
int mr=(int)Math.sqrt( ( x - circle_center.x ) * ( x - circle_center.x ) +
( y - circle_center.y ) * ( y - circle_center.y ) );
if ... | 6 |
@Override
public PreparedStatement getStatement() throws SQLException
{
Connection connection = getConnection();
if (connection != null)
return connection.prepareStatement("select QuestionId, ParentId, Number, TypeNum, Question, Answer, " +
"PassCriteria, Authors... | 1 |
@Get("json")
public Representation _get() {
String keyword = getAttribute("keyword");
String query = format(FIND_RSRC, keyword);
Map<?, ?> ns = $namespaces.findOne(query).as(Map.class);
if (ns == null) {
setStatus(Status.CLIENT_ERROR_NOT_FOUND);
return null;
... | 6 |
@Test
public void runTestImplicitFlow3() throws IOException {
InfoflowResults res = analyzeAPKFile("ImplicitFlows_ImplicitFlow3.apk", true);
Assert.assertEquals(2, res.size());
} | 0 |
public void show() {
XYSeries series = new XYSeries("Amplitude Maxes");
for (int i = 0; i < maxes.size(); i++) {
series .add(new XYDataItem((Number) (i * granularity), (Number) maxes.get(i)));
}
LineChartFrame
frame = new LineChartFrame("Amplitude Maxes", "Ti... | 1 |
public static QcTestStatus fromValue(String statusText)
{
QcTestStatus status = null;
for (QcTestStatus st : QcTestStatus.values()) {
if (statusText.equals(st.toString())) {
status = st;
break;
}
}
return status;
} | 2 |
@Override
public void includeFasls() {
for (File f : layout.faslFiles()) {
ExpressionBuilder builder = new ExpressionBuilder("load");
builder.addString(f.getPath());
this.addExpression(builder.getExpression());
}
} | 1 |
public static void main(String[] args) {
String trainPath = args[0];
String testPath = args[1];
if(trainPath.contains("=")) {
trainPath = trainPath.split("=")[1];
if(trainPath.startsWith("<") && trainPath.endsWith(">")) {
trainPath = trainPath.substring(1, trainPath.length() - 1);
}
}
i... | 7 |
@Override
public void onWin(WinEvent event) {
setAhead(0);
if (new Random().nextInt(3) == 2) {
while (true) {
setTurnRight(500);
setTurnGunLeft(500);
execute();
}
} else {
while (true) {
setTu... | 3 |
public void printHeader()
{
for (int i=0; i < (HEADER_SIZE-4); i++)
{
for (int j = 7; j>=0 ; j--)
if (((1<<j) & header[i] ) != 0)
System.out.print("1");
else
System.out.print("0");
System.out.print(" ");
}
System.out.println();
} | 3 |
public MooreTransitionCreator(AutomatonPane parent)
{
super(parent);
} | 0 |
private String prefixForward (int length) {
if (pointer + length + 1 >= buffer.length()) update(length + 1);
String buff = null;
if (pointer + length > buffer.length())
buff = buffer.substring(pointer, buffer.length());
else
buff = buffer.substring(pointer, pointer + length);
char ch = 0;
for (int i =... | 7 |
@Override
public String toString() {
return "Praticien{" + "numero=" + numero + ", nom=" + nom + ", prenom=" + prenom + ", adresse=" + adresse + ", cp=" + cp + ", ville=" + ville + ", coef=" + coef + ", code=" + code + '}';
} | 0 |
public static void main(String[] args) {
int numberOfTests = Integer.parseInt(args[0]);
int sequencesSize = Integer.parseInt(args[1]);
Random random = new Random();
Format format = new Pair();
try {
List<String> matrices = new ArrayList<String>();
for (I... | 8 |
public String className() {
if ((desc.charAt(0) == Type.ARRAY_CHAR) || this.isPrimitive()) {
return desc;
}
return desc.substring(1, desc.lastIndexOf(';'));
} | 2 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob==invoker)
return true;
if(invoker==null)
return true;
final Room room=invoker.location();
if((!mob.isInCombat())&&(room!... | 7 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
String string=scanner.next();
int temp=0;
int multi=0;
if(string.length() <1)
{
System.out.println("-1");
return;
}
else{
if(string.charAt(0) == '0'){
if(str... | 6 |
public double getTotalValue(ArrayList<Double> amounts) {
double total = 0;
if (amounts.size() < items.size()) {
for (int i = amounts.size(); i < items.size(); i++) {
amounts.add(0.0);
}
}
for (int i = 0; i < amounts.size(); i++) {
total... | 3 |
public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Stateme... | 7 |
public static void main(String[] args) throws UnknownHostException {
if(args.length != 5) {
printUsage();
}
short srcPort = Short.parseShort(args[0]);
short desPort = Short.parseShort(args[1]);
int windowSize = Integer.parseInt(args[2]);
int timeout = Integer.parseInt(args[3]);
String filename = ar... | 5 |
private void loadDirectory(File f){
if (f.isDirectory()){
File[] files = f.listFiles();
if (files == null){
return;
}
for (File f1 : files){
if (f1.isDirectory()){
loadDirectory(f1);
} else {
... | 5 |
public String getUrl(String dbName) {
if (type.equalsIgnoreCase("mysql")) {
return String.format("jdbc:mysql://%s:%s/%s?useUnicode=true&characterEncoding=utf8", ip, port, dbName);
} else {
return "";
}
} | 1 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ReinforcementKey)) return false;
ReinforcementKey key = (ReinforcementKey) o;
return x == key.x && y == key.y && z == key.z && world.equals(key.world);
} | 5 |
public ContactEntity() {
setId(System.nanoTime());
} | 0 |
public void draw(){
for (int x = 0; x < mobs.size(); x++){
AbstractMob current = mobs.get(x);
if (isInSightRange(current.getX(), current.getY())){
int xDraw = 13 - (Boot.getPlayer().getX() - current.getX());
xDraw = xDraw * Standards.TILE_SIZE;
int yDraw = 13 - (Boot.getPlayer().getY() - cu... | 2 |
public static boolean assignDeptToProfessor(ProfessorBean professor)
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
boolean result=true;
try{
String sql="INSERT INTO professor(p_id,subjects,deptid) values (?,?,?)";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareState... | 7 |
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
int size = in.nextInt();
if (size == 0)
break;
blocks = new Point[size];
for (int i = 0; i < size; i++)
blocks[i] = new Point(in.next... | 3 |
public void removeTroop(int i) {
if (troop.getEffectif()<2){
troop=null;
}else{
switch(i){
case 0:
troop.rmToop(1,0,0,0);
break;
case 1:
troop.rmToop(0,1,0,0);
break;
case 2:
troop.rmToop(0,0,1,0);
break;
case 3:
troop.rmToop(0,0,0,1);
break;
}
... | 5 |
private void button20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button20ActionPerformed
if (order2code4tf.getText().equals("1001"))
{
o2c4destf.setText("Chicken Nugget");
}
if (order2code4tf.getText().equals("1002"))
{
o2c4... | 9 |
public static void renderAll(float dt) {
// Theoretically should be faster due to fewer cache misses. At least according to a
// StackOverflow thread I once read:
// http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array
//
// A... | 5 |
@Test
public void testExplicitConversions() {
for (int i = 0; i < typesToTest.length; ++i) {
for (int j = 0; j < typesToTest.length; ++j) {
boolean canImplicit = typesToTest[i].canConvertImplicit(typesToTest[j]);
boolean canExplicit = typesToTest[i].canConvertExplicit(typesToTest[j]);
String cast... | 5 |
private Solution recursiveDepthLimitedSearch(Node node, Puzzle puzzle,
int bound) {
if (puzzle.getGoalTest().isGoalState(node.getState())) {
return new Solution(node, getNodeExpanded());
} else if (bound == 0) {
return new Solution(null, getNodeExpanded());
} else {
LinkedList<Node> expansion = node.e... | 5 |
public void run() {
new File("Game/").mkdir();
try {
String[] files = getFiles("Game/");
launcher.setFileNumber(files.length);
for (String s : files) {
if (s.endsWith("/")) {
launcher.append("Creating folder '" + s + "'");
new File(s).mkdir();
} else {
launcher.append("Downloading '"... | 3 |
public ByteBuffer readLengthAndData(SocketChannel ch) throws Exception {
if(bufs[0].hasRemaining() && ch.read(bufs[0]) < 0)
throw new EOFException();
if(bufs[0].hasRemaining())
return null;
int len=bufs[0].getInt(0);
if(bufs[1] == null || len > bufs[1].capacity(... | 8 |
public static String getFirstLetter(String oriStr)
{
String str = oriStr.toLowerCase();
StringBuffer buffer = new StringBuffer();
char ch;
char[] temp;
for (int i = 0; i < str.length(); i++)
{ // 依次处理str中每个字符
ch = str.charAt(i);
temp = new char[] { ch };
byte[] uniCode = new Stri... | 3 |
public void processEvent(Event event)
{
OMMMsg msg = ((OMMItemEvent)event).getMsg();
GenericOMMParser.parseMsg(msg, System.out);
if (msg.isFinal())
{
stopTest();
}
else if (!m_loggedIn
&& ((msg.getMsgType() == OMMMsg.MsgType.STATUS_RESP) ... | 6 |
public void senseDialDown() throws DialErrorException {
if(d.getDialPosition() == 1) {
System.out.println("Already on lowest setting");
throw new DialErrorException();
}
else {
d.setDialPosition(d.getDialPosition()-1);
if((l.getLeverPosition()).equals("INT")) {
switch(d.getDialPosition()) {
case 1: {
w.setW... | 5 |
public HBox buildDayRepeatButtons() {
dayRepeatButtons = new HBox();
Locale loc = Locale.getDefault();
for(final DayOfWeek day : DayOfWeek.values()) {
String label = day.getDisplayName(TextStyle.SHORT, loc);
final ToggleButton dayButton = new ToggleButton(label);
... | 1 |
@Override
public void run() {
while (isRunning) {
// Edible processing
if (this.deadly == false) {
this.edibleLifeRemaining--;
if (this.edibleLifeRemaining <= 0) {
this.deadly = true;
}
}
/... | 8 |
private String buildPotFxString(Collection<PotionEffect> effects) {
if (effects.size() < 1)
return null;
StringBuilder sbType = new StringBuilder();
StringBuilder sbDur = new StringBuilder();
StringBuilder sbAmp = new StringBuilder();
for (PotionEffect effect : effects) {
sbType.append(effect.getType(... | 2 |
public static Object extractFromDatagram(DatagramPacket datagram) throws IOException {
try(ByteArrayInputStream byteIn = new ByteArrayInputStream(datagram.getData())) {
try(ObjectInputStream ois = new ObjectInputStream(byteIn)) {
try {
return ois.readObject();
} catch(ClassCastException e) {
L... | 2 |
private void createJK(String in1, String in2, String out)
{
JKFlipFlop jk = new JKFlipFlop();
// Connect the first input
// Check if the in wire is an input
if (stringToInput.containsKey(in1))
{
Wire inWire = new Wire();
stringToInput.get(in1).connectOutput(inWire);
jk.connectInput(inWire);
}
/... | 8 |
@Override
public void onSpawnTick(SinglePlayerGame game) {
Set<Location> temp = new HashSet<>();
for (Location loc : toSpawn) {
if (!game.spawnEntity(loc, spawn())) {
temp.add(loc);
}
}
toSpawn = temp;
} | 2 |
public String getFormattedResult(boolean hasColors) {
try {
gson = new GsonBuilder().setPrettyPrinting().create();
} catch(IllegalStateException ex) {
ex.printStackTrace();
return "";
}
PirateBayJsonItem[] results = gson.fromJson(this.getJson(), PirateBayJso... | 5 |
public HashSet<String> connectTo(String word) {
char[] wordChars = word.toCharArray();
HashSet<String> result = new HashSet<String>();
for (int i = 0; i < wordChars.length; i++) {
char before = wordChars[i];
wordChars[i] = (char) 0;
Str... | 2 |
protected ActorMind initAI() {
final Artilect actor = this ;
return new ActorMind(actor) {
protected Behaviour createBehaviour() {
final Choice choice = new Choice(actor) ;
addChoices(choice) ;
return choice.pickMostUrgent() ;
}
protected void updateAI(int... | 4 |
public void run(String arg) {
// 1 - Obtain the currently active image if necessary:
ImagePlus imp = IJ.getImage();
if (null == imp) return;
int stackSize = imp.getStackSize();
// 2 - Ask for parameters:
boolean whiteParticles =Prefs.blackBackground, addTop = true, addRight = true, addBot... | 7 |
public static void main(String[] argv) {
if (argv.length == 2) {
if (argv[0].equals("rabbitmq"))
systemToCheck = "rabbitmq";
else if (argv[0].equals("sqs"))
systemToCheck = "sqs";
else if (argv[0].equals("both"))
systemToCheck =... | 8 |
void heightChange(final Object inst) {
if (inst instanceof Instruction) {
((Instruction) inst).visit(this);
}
} | 1 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(msg.targetMinor()==CMMsg.TYP_DRINK)
&&(msg.target() instanceof Drink)
&&(msg.target() instanceof ... | 7 |
public double getHeight(Graphics pen)
{
Graphics2D p = (Graphics2D) pen;
FontRenderContext frc = p.getFontRenderContext();
TextLayout layout = new TextLayout("b", FONT, frc); // use the same letter to determine the height
return layout.getBounds().getHeight();
} | 0 |
public static double trainAndTestCaseMatcher(Symbol className, Symbol slotName, int numTrain, int numTest, int cycles) {
className = ((Symbol)(className.permanentify()));
slotName = ((Symbol)(slotName.permanentify()));
{ Surrogate renamed_Class = Logic.getDescription(className).surrogateValueInverse;
... | 7 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if(qName.equalsIgnoreCase("site")) {
mCurrentParsingInfo.put(DocumentHeaders.SITE_ID, attributes.getValue("id"));
mCurrentParsingInfo.put(DocumentHeaders.SITE_... | 8 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... | 7 |
public final void run() {
while (!aBoolean1738) {
FileIndexRequest request;
synchronized (requestQueue) {
request = ((FileIndexRequest) requestQueue.removeFirst());
if (request != null)
((FileIndexWorker) this).amountRequests--;
else {
try {
requestQueue.wait();
} catch (Interrupte... | 6 |
public static void main(String[] args) throws Exception {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
stk = new StringTokenizer(in.readLine());
int zeroes = readInt();
int ones = readInt();
// Fail fast
if (zeroes - 1 > ones || ones - zeroes - 2 > ze... | 9 |
public Map<FieldDescriptorType, Object> getAllFields() {
if (hasLazyField) {
SmallSortedMap<FieldDescriptorType, Object> result =
SmallSortedMap.newFieldMap(16);
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
cloneFieldEntry(result, fields.getArrayEntryAt(i));
}
fo... | 5 |
public void purgeOnlineModsTable(){
if (purgedOnlineList) return;
for (int i = 0;i<mods.size();i++){
for (int o = 0;o<onlineModList.size();o++){
if (mods.get(i).name.equals(onlineModList.get(o).name)){
onlineModList.remove(o);
o--;
}
}
}
int i = 0;
int numFrameworks = 0;
while (i... | 7 |
public static void unbanIP( String player, String sender ) throws SQLException {
if ( !Utilities.isIPAddress( player ) ) {
player = PlayerManager.getPlayersIP( player );
}
SQLManager.standardQuery( "DELETE BungeeBans FROM BungeeBans INNER JOIN BungeePlayers ON BungeeBans.player = Bun... | 2 |
public boolean isSolidTile(float xa, float ya) {
int x0 = (int) (x + xa + 3) / 16;
int x1 = (int) (x + xa + 8) / 16;
int y0 = (int) (y + ya + 2) / 16;
int y1 = (int) (y + ya + 8) / 16;
if (level.getSolidTile(x0, y0) != null) return true;
if (level.getSolidTile(x1, y0) != null) return true;
if (level... | 4 |
public static Stella_Object walkStatement(Stella_Object tree, boolean warnonatomP) {
{ Stella_Object otree = null;
StandardObject unusedtypespec = null;
{ Object [] caller_MV_returnarray = new Object[1];
otree = Stella_Object.walkATree(tree, caller_MV_returnarray);
unusedtypespec = ((S... | 6 |
public boolean hasParentheses(){
Pattern pattern = Pattern.compile("[(][0-9¥+¥-¥*/]+[)]");
Matcher matcher = pattern.matcher(expression);
return matcher.find() ? true : false;
} | 1 |
public int depthOfNodeNoStorage(treeNode node) {
count2++;
if (node == null)
return 0;
int leftDepth = depthOfNodeNoStorage(node.leftLeaf);
int rightDepth = depthOfNodeNoStorage(node.rightLeaf);
return (leftDepth >= rightDepth ? leftDepth + 1 : rightDepth + 1);
} | 2 |
protected void updateEntityActionState()
{
this.despawnEntity();
EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (var1 != null)
{
this.faceEntity(var1, 10.0F, 20.0F);
}
if (this.onGround && this.slimeJumpDelay-- <= 0... | 6 |
public String read(){
data.readSettings();
data.checkOSType();
String readIn = "";
String line = null;
try{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(data.getGamePath() + "/" + data.getGamePath().substring(data.getGamePath().lastIndexOf("/")) + ".json")));
w... | 7 |
public BasicAxes(){
this.name = Constants.BASIC_SWORD;
this.attackScore = 2;
this.attackSpeed = 2;
this.money = 0;
} | 0 |
public int getInt(String key) throws JSONException {
Object object = get(key);
try {
return object instanceof Number ?
((Number)object).intValue() :
Integer.parseInt((String)object);
} catch (Exception e) {
throw new JSONException("JSONObje... | 2 |
@Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args)
{
// See if any arguments were given
if (args.length == 0)
{
// Check if they have "karma" permission
this.displayHelp(sender);
}
else
{
final String com = args[0].toLowerCase();
if (co... | 7 |
public boolean updateId(long userId, DocumentUpdate changes) {
boolean r = false;
if (changes.isJobTitleChange()) {
r = jobTitleIndex.modifyIdKey(changes.getOldJobTitle(), changes.getNewJobTitle(), userId);
}
if (changes.isIndustryChange()) {
r = industryIndex.mod... | 8 |
public void fireEvent(ZWCmdClass cmd){
ZWEvent event = new ZWEvent(nodes.get((int)cmd.node),cmd.cmdClass,cmd.cmd,cmd.data);
switch(cmd.cmdClass){
case (byte)0x20: //basic
nodes.get((int)cmd.node).fireZWBasicEvent(event);
break;
case (byte)0x70: // ... | 7 |
public final void expr() throws RecognitionException {
try {
// Python.g:318:6: ( xor_expr ( VBAR xor_expr )* )
// Python.g:318:8: xor_expr ( VBAR xor_expr )*
{
pushFollow(FOLLOW_xor_expr_in_expr2611);
xor_expr();
state._fsp--;
if (state.failed) return;
// Python.g:318:17: ( VBAR xor_expr )*
... | 7 |
public void printTries(){
System.out.println("root");
LinkedList<Node> queue = new LinkedList<Node>();
queue.addLast(root);
int size = 1, next_size = 0;
while(!queue.isEmpty()){
Node x = queue.getFirst();
queue.removeFirst();
System.out.print(Arrays.toString(x.childs));
size--;
for(Node t : ... | 4 |
public AbstractMatter get(Class c){
for(AbstractMatter e : list)
{
if(e.getClass().getSuperclass() == c)
{
return e;
}
}
return null;
} | 2 |
public void borrarTabla(String nombreTabla)
{
try
{
this.bd.open();
this.bd.beginTransaction(SqlJetTransactionMode.WRITE);
// Esta función borra la tabla que le pasemos por la variable
this.bd.dropTable(nombreTabla);
// Esta función se u... | 1 |
private void finishReceivingFile(final boolean isSucceed) {
try {
this.writeChannel.truncate(receivedLength);
this.writeChannel.force(true);
this.writeChannel.close();
this.writingFile.close();
} catch (Exception e) {
e.printStackTrace(System.out);
}
if (!isSucceed) {
this.localReceivingFile.d... | 7 |
public static int glLoadLinearPNG(String location) {
int texture = glGenTextures();
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture);
InputStream in = null;
try {
in = ClassLoader.getSystemResourceAsStream(location);
PNGDecoder decoder = new PNGDecoder(in);
ByteBuffer buff... | 4 |
public synchronized void addSearchedSites(String url){
try{
String line = "";
while((line = in.readLine()) != null){
bw.write(line + "\r\n");
}
bw.write(url);
}catch (Exception ex){
System.out.println(ex);
}
} | 2 |
public DressCode getDressCode() {
return dressCode;
} | 0 |
private ArrayList<Integer> mergeSortedLists(ArrayList<Integer> first, ArrayList<Integer> second) {
ArrayList<Integer> ret = new ArrayList<>();
int fstIdx = 0;
int sndIdx = 0;
while (fstIdx < first.size() && sndIdx < second.size()) {
if (first.get(fstIdx) < second.get(sndIdx... | 9 |
public void displayGrid() {
displayEndBorder();
for (int x=0; x < sudokuGrid.length; x++) {
if (x%size == 0 && x != 0) {displayMiddleBorder();}
for (int y=0; y < sudokuGrid[x].length; y++) {
System.out.print((y==0 || y%this.size==0 ? "| " : ""));
System.out.print(sudokuGrid[x][y] + " ");
Sy... | 7 |
protected static Ptg calcTBillPrice( Ptg[] operands )
{
if( operands.length < 3 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcTBILLPRICE" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getVa... | 5 |
public byte[] removeAttribute(String name) {
if (unknownAttributes != null)
return (byte[]) unknownAttributes.remove(name);
return null;
} | 1 |
private static AttributeDomain parseDomain(Element domainElem) throws IOException {
if (domainElem == null) return null;
try {
if (domainElem.getAttribute("type").equals("continuous")) {
ContinuousAttributeDomain domain = new ContinuousAttributeDomain();
NodeL... | 7 |
@Override
public void error(SAXParseException e) {
System.out.println("SAXParserException Error: " + e.getMessage());
this.errorOccurred = true;
} | 0 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(mob.location().fetchEffect(ID())==null)
unInvoke();
}
else
if(affected instanceof Roo... | 9 |
public static List<String> getDepartments()
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
List<String> result=new ArrayList<String>();
try{
String sql="SELECT * FROM department";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
rs=ps.executeQuery();... | 8 |
@SuppressWarnings("unchecked")
private void insert(HashElement<T> val)
{
insertedElements++;
boolean found_spot = false;
for(int i=0; i<this.table_hashes_used && !found_spot; i++)
{
// if it found an open available spot to place the element
if(m_table[val.getHashValue().hash(i, m_table.length)] == ... | 9 |
public void destroy() {
// TODO Auto-generated method stub
} | 0 |
@Override
public void setDNA(int[] dna) {
this.dna = new int[boardLength];
int newDNASize = dna.length;
for (int i = 0; i < boardLength; i++)
this.dna[i] = (i < newDNASize && dna[i] > 0 && dna[i] < boardLength) ? dna[i] : 0;
fitnessScore = determineFitness();
} | 4 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
@SuppressWarnings("unchecked")
private void loadModsFromConfigList() throws IOException {
ArrayList<?> newList = config.get(CONFIG_MODLIST, ArrayList.class);
if(newList != null) {
for(Object o : newList) {
if(!(o instanceof ExtendedModInfo)) {
newList = null;
break;
}
}
}
if(newLi... | 5 |
private void handleRun(CommandSender sender, String label, String[] args)
{
if(args.length != 0)
{
sender.sendMessage(ChatColor.RED + String.format("Usage: /%s run", label));
return;
}
sender.sendMessage(ChatColor.YELLOW + "Running all rules.");
mPlugin.runGroups(true);
} | 1 |
public List<PhpposItemsEntity> getItemsEntities(){
return getHibernateTemplate().find("from PhpposItemsEntity ");
} | 0 |
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.