text stringlengths 14 410k | label int32 0 9 |
|---|---|
public CheckResultMessage checkF01(int day) {
int r1 = get(20, 5);
int c1 = get(21, 5);
int r2 = get(27, 5);
int c2 = get(28, 5);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1, c1 + day, 5).compareTo(
... | 5 |
public LsCommand execute() throws IOException {
Path path = Paths.get(ls.getPath());
LsVisitor visitor = new LsVisitor(path, ls.getGlob());
Files.walkFileTree(path, Collections.EMPTY_SET, ls.getDepth(), visitor);
this.listing = visitor.getListing();
// sort listing
if(l... | 8 |
public boolean canMove(){
int rangee = -1;
for(boolean bool[] : tetrominoes.get(tetrominoes.size()-1).getEmplacement().getCoordoneeJeu()){
rangee++;
for(int x=0; x< coordonneJeu.getNombreColonne(); x++)
if(true==bool[x]&& bool[x]== !coordonneJeu.IsEmpty(x, rangee)... | 4 |
private void pause() {
fallTimer.stop();
paused = true;
this.add(resumeButton);
this.remove(gameGrid);
this.remove(holdGrid);
for (int i = 0; i < QUEUE_SIZE; ++i) {
this.remove(inQueueGrid[i]);
}
repaintGrid();
this.add(resumeButton);
} | 1 |
Manager() {
LOGGER.log(Level.INFO, "Loading profiles.");
profiles = FrolfUtil.loadProfiles();
currentProfile = null;
try {
LOGGER.log(Level.INFO, "Loading courses.");
courses = FrolfUtil.loadCourseCatalog();
LOGGER.log(Level.INFO, "Loading discs.");
discs = FrolfUtil.loadDisc... | 3 |
public static void main(String[] args) {
// First we set up the BasicDataSource.
// Normally this would be handled auto-magically by
// an external configuration, but in this example we'll
// do it manually.
//
System.out.println("Setting up data source.");
DataSo... | 9 |
private void onLeftReleased(){
if(selectedNode == null){
for(Node node : this.getNodes()){
double radiusSquared = node.size * node.size,
dx = mouseX - node.position.x, dy = mouseY - node.position.y,
distSquared;
distSquared = dx * dx + dy * dy;
if(distSquared <= radiusSquared){
selecte... | 6 |
public void printTopWords(int k, String betaFile) {
double loglikelihood = calculate_log_likelihood();
System.out.format("Final Log Likelihood %.3f\t", loglikelihood);
String filePrefix = betaFile.replace("topWords.txt", "");
debugOutput(filePrefix);
Arrays.fill(m_sstat, 0);
System.out.println("print to... | 9 |
public static Language getInstance() {
return language;
} | 0 |
@Override
protected void fireEditingStopped() {
super.fireEditingStopped();
} | 0 |
public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 72
// do, line 74
v_1 = cursor;
lab0: do {
// call mark_regions, line 74
if (!r_mark_regions()) {
break lab0;
}
} while (false);
cursor = v_1;
// backwards, line 75
limit_backward = cursor;
cursor = limit;
//... | 8 |
public double getBalance(){
return this.balance;
} | 0 |
public synchronized void open(Decoder decoder) throws JavaLayerException
{
if (!isOpen())
{
this.decoder = decoder;
openImpl();
setOpen(true);
}
} | 1 |
public final String getCancelView() {
// Default to successView if cancelView is invalid
if (this.cancelView == null || this.cancelView.length() == 0) {
return getSuccessView();
}
return this.cancelView;
} | 2 |
public static String multiLineToolTip(int len, String input) {
String s = "";
int length = len;
if (input == null)
return "";
if (input.length() < length)
return input;
int i = 0;
int lastSpace = 0;
while (i + length < input.length()) {
String temp = input.substring(i, i + length);
lastSpace... | 3 |
public ArrayList<Assessoria> consultar(String id){
ArrayList<Assessoria> ass = new ArrayList<>();
try {
if(id.equals("")){
sql="SELECT * FROM tb_assessoria;";
}else{
sql="SELECT * FROM tb_assessoria WHERE cod = '"+id+"';";
... | 3 |
public static void gerarArquivoRedeNeural(String nome,
MultiLayerPerceptron rna, Double[] entradas) {
try {
FileWriter fileWriter = new FileWriter(nome);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
double discretizacao = 0.05;
for (int i = 0; i < 20; i++) {
rna.inicializarPesos... | 9 |
public void play() {
try {
new Thread() {
public void run() {
clip.setFramePosition(0);
clip.start();
}
}.start();
} catch (Throwable e) {
e.printStackTrace();
}
} | 1 |
@EventHandler
public void IronGolemResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getIronGolemConfig().getDouble("IronG... | 6 |
private void createFile(){
if ((nameTextField != null)
&& (pathFileTextField != null)){
algorythmFile = new AlgorythmFile(
nameTextField.getText(),
algoTypeComboBox.getSelectedItem().toString(),
file
... | 2 |
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (!par1World.isRemote)
{
if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
{
par1World.... | 8 |
int classend(int poffset) {
switch (p.luaByte(poffset++)) {
case L_ESC:
if (poffset == p.length()) {
error("malformed pattern (ends with %)");
}
return poffset + 1;
case '[':
if (p.luaByte(poffset) == '^')
poffset++;
do {
if (poffset == p.length()) {
error("malformed p... | 8 |
public String Imprimir()
{
String impresion="";
for (int i=0; i < matriz.length; i++) {
for (int j =0; j < matriz[0].length; j++) {
if(i==j)
{
impresion +="X";
}
else
{
... | 3 |
@Test
public void evaluatePostfix6() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException
{
try
{ String whatItStartsAs = "23+59+2/3++952+-89*-+";
postfix.addLast("5");
postfix.addLast("9");
postfix.addLast("+");
... | 5 |
public int partition(T[] data, int length, int start, int end) {
// TODO Auto-generated method stub
if(data == null || length <=0 || start < 0 || end >= length){
throw new IndexOutOfBoundsException("argument error!");
}
Random r = new Random();
//nextInt(0,n+1) create an int in [0, n+1) == [0, n];
int in... | 7 |
public static void main(String[] args) {
int length = Integer.parseInt(JOptionPane.showInputDialog("Input the Number (2k - 1)"));
int intArray[][] = new int[length][length];
if (length % 2 != 0) {
makeArray(intArray);
JOptionPane.showMessageDialog(null, "Take a look at th... | 1 |
public static void main(String[] args)
{
MyTargetTest myTarget = new MyTargetTest();
myTarget.target();
} | 0 |
public static synchronized String checkOneLink(URL linkURL) {
// System.out.printf("LinkChecker.checkLink(%s)%n", linkURL);
try {
final String canonURLString = uc.canonicalize(linkURL.toString());
if (cache.contains(canonURLString))
return "(already checked)";
cache.add(canonURLString);
linkURL = n... | 8 |
public String getBeforeIndex(byte type, int index)
{
if (index < 0 || index > getText().length() - 1)
{
return null;
}
switch (type)
{
case CHARACTER:
if (index == 0)
{
return null;
}
return getText().substring(index - 1, index);
case WORD:
... | 9 |
public QuickCodePopupMenu(SourceFileEditor editor) {
super("Quick Code");
this.editor = editor;
// Construct Menu items);
JMenu opCodes = new JMenu("Insert OpCode");
// OpCode menu items are auto-generated later on
JMenu statements = new JMenu("Build... | 9 |
@Override
public Object getValueAt(int row, int col) {
Time_Sheet vo = vos.get(row);
switch (col) {
case 0:
return vo.getPosition().getName();
case 1:
return vo.getFireman().getFirstName() + " " + vo.getFireman().getLastName();
case... | 8 |
public void doNewGame(){} | 0 |
private void send(OutputStream outputStream) {
String mime = mimeType;
SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
if (status == null) {
... | 9 |
private double getMaxValue(Angle angle,
double time, double timeStep, double epsilon, double delta,
FirstOrderIntegrator integrator, double[] initialState) {
double max = 0;
double timeOfMax = 0;
double t = timeStep;
while (t ... | 6 |
private void handleAwayStatusResponse(int code) {
boolean isAway = (code == RPL_NOWAWAY);
if (serverEventsListener != null)
serverEventsListener.awayStatusChanged(isAway);
for (ChannelEventsListener listener : channelEventsListeners)
listener.awayStatusChanged(isAway);
... | 3 |
public WorldListener(TotalPermissions p) {
plugin = p;
} | 0 |
@Override
public InputStream getInputStream() {
try {
boolean spawn=true;
if(!this.downloading) {
this.downloading=true;
if(song.delay()==-1)
spawn=false;
if(song.save()) {
OutputStream[] os=new OutputStream[2];
os[0]=this.out;
os[1]=new FileOutputStream(song.fileName());
t... | 5 |
public void setVertex1(final int x, final int y, final int z) {
if (this.x1 != null && this.y1 != null && this.z1 != null && this.x1 == x && this.y1 == y && this.z1 == z) return;
this.x1 = x;
this.y1 = y;
this.z1 = z;
this.refresh();
} | 6 |
public void creeper(Boolean mode){
if (mode != null){
creeper = mode;
}else{
creeper = true;
}
} | 1 |
public P335B() {
Scanner sc = new Scanner(System.in);
s = sc.next();
final int N = s.length();
markPrev = new int[101];
markCurr = new int[101];
for (int i = 0; i < 101; i++) {
markPrev[i] = markCurr[i] = -1;
}
next = new ArrayList<Arr... | 9 |
public static Graph wireScaleFreeBA( Graph g, int k, Random r ) {
final int nodes = g.size();
if( nodes <= k ) return g;
// edge i has ends (ends[2*i],ends[2*i+1])
int[] ends = new int[2*k*(nodes-k)];
// Add initial edges from k to 0,1,...,k-1
for(int i=0; i < k; i++)
{
g.setEdge(k,i);
ends[2*i]=k;
en... | 8 |
int[] getCentromereSortOrder() {
int[] centro;
if (haplostruct.length==2) {
//bivalent
if (rand.nextBoolean())
centro = new int[] {0,0,1,1};
else centro = new int[] {1,1,0,0};
}
else {
//parallel multivalent (Quadrivalent ... | 5 |
@Override
public void paintBorder(Graphics g) {
if (paintBorder) {
Graphics2D g2 = (Graphics2D) g.create();
g2.setPaint(color);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
... | 7 |
public boolean prayer() {
if (playerLevel[playerPrayer] >= prayer[1]) {
if (actionTimer == 0 && prayer[0] == 1 && playerEquipment[playerWeapon] >= 1) {
//actionAmount++;
prayer[0] = 2;
}
if (actionTimer == 0 && prayer[0] == 2) {
deleteItem(prayer[4], prayer[5],... | 6 |
@Override
public void propertyChange(PropertyChangeEvent evt) {
rosterTableModel.fireTableStructureChanged();
rosterTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
for (int i = 2; i < rosterTable.getColumnCount(); i++)
rosterTable.getColumnModel().getColumn(i).setPreferredWidth(45);
} | 1 |
public void persistCSVData(List<User> rawusers, List<Interest> interests, List<Availability> availabilities, Model model) throws Exception{
Map<Integer, UserData> users = persistAdresses(availabilities, persistInterests(interests, persistUsers(rawusers)));
for (UserData user : users.values()) {
... | 1 |
public void deleteByKey(long pBlogId){
this.blogModelBS.deleteByKey(pBlogId);
} | 0 |
private static int countMp3Files(File directory) throws IOException
{
int numMp3s = 0;
for(File file : directory.listFiles())
{
if (file.isDirectory())
{
numMp3s += countMp3Files(file);
}
else if (file.getName().endsWith(".mp3"))
{
... | 3 |
public void run() {
this.done = false;
try {
if (serverMode) {
client = new Socket(objectatHost, objectatPort);
StringWriter stringWriter = new StringWriter();
String eventXML = "";
while (!this.done) {
}
}
if (clientMode) {
this.client = new Socket(objectatHost, o... | 8 |
public synchronized static void appendTextPane(Color color, String message, JTextPane box)
{
StyledDocument doc = box.getStyledDocument();
Style style = box.addStyle("style", null);
/*if (color == null) {
color = new Color(255, 255, 255);
}*/
StyleConstants.setFor... | 2 |
public static char[] findLongestCommonSubstringUsingTries(char[] s1, char[] s2) {
int[][] length = new int[s1.length][s2.length];
int maxLength = 0; int maxi=-1;
for(int i=0;i<s1.length; i++){
for( int j=0; j< s2.length; j++) {
// if the characters match
... | 7 |
private static List<PositionEntity> getMovePositionsKing(final ChessBoardEntity b, final ChessmenEntity c) {
List<PositionEntity> result = new ArrayList<PositionEntity>();
PositionEntity p = null;
p = new PositionEntity(c.getPosition().getX() - 1, c.getPosition().getY() - 1);
if (enablePosition(b, p)) {
resu... | 8 |
@Override
public boolean isValid() {
return data != null && fa.isValid();
} | 1 |
public static void main(String[] args) throws FileNotFoundException {
//-------------------------------------------------
// Generate Random strings + Write to file
//-------------------------------------------------
PrintStream diskWriter = new PrintStream(PASSWORD_DUMP_FILENAME);
for (int kk = 1; kk <= ITEM... | 9 |
public Set<ChessPiece> filterMoves(Set<ChessPiece> possibleMoves, ChessPiece[][] board) {
ChessPiece[][] tempBoard = new ChessPiece[8][8];
Set<ChessPiece> checkedMoves = new HashSet<ChessPiece>();
//copy the board over piece by piece, to eliminate aliasing
//also, find the coordinates of the selected piece
... | 8 |
public void setCurrentPath(String relativePath){
File file = new File(ProjectMgr.getAssetsPath() ,relativePath);
if(!file.exists()){return;}
while(file.getParent() != null && !file.getParent().equals(ProjectMgr.getAssetsPath())){
file = file.getParentFile();
... | 3 |
public void put(String name, Scriptable start, Object value)
{
int info = findInstanceIdInfo(name);
if (info != 0) {
if (start == this && isSealed()) {
throw Context.reportRuntimeError1("msg.modify.sealed",
name);
... | 9 |
private ArrayList<Value> convertInsertValuesType(Table tableDef, ArrayList<String> values) throws Error{
ArrayList<Value> valueList = new ArrayList<Value>();
ArrayList<Attribute> attrList = tableDef.getAttrList();
String tableName = tableDef.getTableName();
int attrSize = attrList.size();
if(attrSize != valu... | 9 |
public void collide(Car other) {
carPhysics.collide(other.carPhysics);
} | 0 |
public void setUpNeuron() throws Exception
{
List<Integer> weights = new ArrayList(Arrays.asList(new Integer[]{Integer.MAX_VALUE/2,Integer.MAX_VALUE/2}));
n= new MyNeuron(weights, new IMyNeuronFunction<Integer>()
{
@Override
public Integer process(List<Integer> inData... | 5 |
@Override
public void focusGained(FocusEvent e) {
recordRenderer(e.getComponent());
textArea.hasFocus = true;
} | 0 |
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null || this.getClass() != object.getClass()) {
return false;
}
return this.uri.equals(((Equivalence) object).getUri()) ;
} | 3 |
private static char[][] getMap(int mapNumber) throws FileNotFoundException, IOException{
/* this makes sure the numberformat is correct with numberlength changes*/
String mapNumberTransformation = "00" + Integer.toString(mapNumber);
mapNumberTransformation = mapNumberTransformation.... | 6 |
public static void update(MySQLObjectMapping updateObj) throws IllegalArgumentException, IllegalAccessException, ClassNotFoundException, SQLException {
Class clazz = updateObj.getClass();
List<Field> ids = updateObj.getIdFields();
StringBuilder whereConditionBuilder = new Strin... | 9 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
int w = getWidth();
int h = getHeight();
g.setColor(selected ? Color.yellow : (color == Side.WHITE) ? DARKBROWN
: LIGHTBROWN);
g.fillOval(0, 0, w, h);
g.setColor((color == Side... | 3 |
public void draw(Graphics g, ImageObserver observer) {
if (image != null)
g.drawImage(image, x, y, width, heigth, observer);
} | 1 |
public static String toStringBytes(byte[] octets){
String aRetourner = "[";
for(int i = 0;i<octets.length;i++){
if (i == 0){
aRetourner += " "+octets[i];
}else{
aRetourner += ", "+octets[i];
}
}
aRetourner += "]";
return aRetourner;
} | 2 |
private static int[] resolveBounds(Rectangle in, boolean warp) {
int x = Math.round((float)in.x / (float)32);
int y = Math.round((float)in.y / (float)32);
int width = Math.round((float)in.width / (float)32);
int height = Math.round((float)in.height / (float)32);
if (!warp) {
... | 4 |
public ArrayList<String> getPicturePaths() {
return PicturePaths;
} | 0 |
static final boolean activate(CellRenderer self, Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState flags) {
boolean result;
if (self == null) {
throw new IllegalArgumentException("self can't be null");
}
if (event == nu... | 7 |
private LegacyInstr decode_22(int word1) throws InvalidInstruction {
// get value of bits logical[12:15]
int value = (word1) & 0x0000F;
switch ( value ) {
case 0x00002: return decode_STPD_2(word1);
case 0x0000F: return decode_PUSH_0(word1);
case 0x0000D: retur... | 9 |
public static int getSmallestShipNotDestroyed()
{
ArrayList<Integer> shipSizesLeft = new ArrayList<Integer>();
for(int size : BattleShipGame.shipSizes)
shipSizesLeft.add(new Integer(size));
for(Ship ship : sunkShips)
shipSizesLeft.remove(new Integer(ship.getSize()));
int smallest = 10000;
for(... | 4 |
ArrayList<String> getGoldRanking(String query) {
//int numResults = 100;
ArrayList<String> gold;
String queryTerms = query.replaceAll(" ", "+");
try{
FileInputStream streamIn = new FileInputStream(this.wikiDirectory +queryTerms +".ser");
ObjectInputStream objectinputstream = new ObjectInputStream(strea... | 8 |
public int synthesis(Packet op){
Info vi=vd.vi;
// first things first. Make sure decode is ready
opb.readinit(op.packet_base, op.packet, op.bytes);
// Check the packet type
if(opb.read(1)!=0){
// Oops. This is not an audio data packet
return (-1);
}
// read our mode and pre/... | 9 |
public static IpInfo getIpInfo(final String ipAddress) {
IpInfo ipLookup = new IpInfo();
if (!IPAddressValidator.getInstance().validate(ipAddress)){
ipLookup.setErrorMsg("Invalid IP Address");
}else{
sortServicesByPriority();
try {
for (int i ... | 4 |
@Override
public boolean equals(Object obj) {
if (obj == this.value)
return true;
if (obj instanceof Value) {
Value v = (Value) obj;
return this.type == v.type && (this.value == v.value || (this.value != null && this.value.equals(v.value)));
} else {
... | 5 |
public void tick() {
super.tick();
if (isWalking) {
ref++;
moveDir(getFacing());
if (ref == 16) {
ref = 0;
isWalking = false;
setTextureRegion(sprites.getSprite(getFacing()));
synchronized (this) {
this.notifyAll();
}
}
}
} | 2 |
public final static boolean isNumberFollowedByString(final String str)
{
if((str==null)||(str.length()<2))
return false;
if(!Character.isDigit(str.charAt(0)))
return false;
int dex=1;
for(;dex<str.length();dex++)
if(Character.isLetter(str.charAt(dex)))
break;
else
if(!Character.isDigit(str.c... | 9 |
public void eat(int id, int slot) {
if (c.duelRule[6]) {
c.sendMessage("You may not eat in this duel.");
return;
}
if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.constitution > 0) {
c.getCombat().resetPlayerAttack();
c.attackTimer += 2;
c.startAnimation(829);
c.getItems().deleteItem(i... | 8 |
public Texture getTexture(String path) throws IOException
{
if (textures.containsKey(path))
{
return textures.get(path);
}
else
{
Texture t = new Texture(getImageFromName(path));
textures.put(path, t);
return t;
}
} | 1 |
@Override
public void componentResized(ComponentEvent e) {
Component comp = e.getComponent();
int width = comp.getWidth();
int height = comp.getHeight();
boolean resize = false;
if (width < minWidth) {
resize = true;
width = minWidth;
}
if (height < minHeight) {
resize = true;
height... | 3 |
public Weapon(Class<? extends T> projectileType, long coolDown, int maxAmmo) {
this.projectileType = projectileType;
lastShot = 0;
this.coolDown = coolDown;
this.maxAmmo = maxAmmo;
this.currentAmmo = maxAmmo;
try {
ctor = getCtor();
} catch (SecurityEx... | 2 |
private Object spawnChoiceWindow(String title, String prompt, Object[] choices)
{
//This will create the dialogue window
dialogSpawner = new JOptionPane(prompt, JOptionPane.QUESTION_MESSAGE,
JOptionPane.DEFAULT_OPTION, null, choices, null);
final JDialog dialog = dialogSpawner.createDialog(null, title);
... | 4 |
public static File criar(String tipoArquivo, String conteudo) throws Exception {
if (
"apresentacao".equals(tipoArquivo)
||
"texto".equals(tipoArquivo)
||
"planilha".equals(tipoArquivo)
) {
IDocumento documento = AbstractDocumento.factory(tipoArquivo, conteudo);
return documento.criar();
... | 6 |
@Override
public String toString() {
StringBuffer sBuff = new StringBuffer();
if (octave < 0) {
for(int i=0; i< (-1)*octave;i++) {
sBuff.append('.');
}
}
if (swar != -1) {
sBuff.append(swarLiterals[swar]);
}
if (octave > 0) {
for(int i=0; i< octave;i++) {
sBuff.append('.');
}
}
... | 5 |
public boolean validate(byte[] piece_hashes, byte[] piece, int piece_index){
//Make sure we don't get an index out of bounds error
if(piece_index != piece_hashes.length)
return false;
byte[] hashed_piece;
MessageDigest create_hash = null;
//The MessageDigest will use the SHA algorithm to create the hash... | 5 |
public int compareTo(DateTime aThat) {
if (this == aThat) return EQUAL;
ensureParsed();
aThat.ensureParsed();
ModelUtil.NullsGo nullsGo = ModelUtil.NullsGo.FIRST;
int comparison = ModelUtil.comparePossiblyNull(this.fYear, aThat.fYear, nullsGo);
if (comparison != EQUAL) return comparison;
... | 8 |
public void paint(Graphics g, int yOffset) {
removeDeadFlyUps();
g.setColor(Color.BLACK);
int bottomEdge = 15 * flyups.size();
bottomEdge += (permanentFlyUp.equals(""))?0:15;
float rgb = (bottomEdge <= (200 + yOffset)) ? 0.0F : 1.0F;
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
g.drawString(perman... | 6 |
private Class[] types(int[] dims, Class basetype) {
int i = 0;
while (dims[i] > -1) {
i++;
}
if (debug) {
System.out.println(" rank " + i);
}
Class[] c = new Class[i];
c[i - 1] = basetype;
while (--i > 0) {
c[i - 1] = Array.newInstance(c[i], 0).getClass();
}
if (debug) {
Sy... | 4 |
@BeforeClass
public static void setUpClass() {
} | 0 |
int divideHelper(int a, int b) {
if (a > b)
return 0;
if (a == b)
return 1;
// shift b to align a and compare with a
int diff = bitDiff(a, b);
if (a < (b << diff))
return (1 << diff) + divideHelper(a - (b << diff), b);
diff--;
... | 3 |
public String getMSISDNString(int position, boolean showAllHex) {
byte[] MSISDN = null;
String MSISDNString = "";
try {
worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID()));
MSISDN = worker.readRecord(position, worker.getResponse(worker.select(DatabaseOfEF.... | 4 |
private static boolean isConflictWithVenue(long startTime, long endTime,
int frequency, long lastDay, long venueId, long exceptApptId,
IsLegalExplain explain) {
try
{
List<Appointment> aAppt = Appointment.findByVenue(venueId);
for (Appointment iAppt : aAppt)
{
if (iAppt.id == exceptApptId)
c... | 5 |
private static void quantityOfProducts() {
mapOfQuantityProducts = new HashMap<String, Integer>();
for (String entry : scanProducts) {
if (mapOfQuantityProducts.containsKey(entry)) {
mapOfQuantityProducts.put(entry, (mapOfQuantityProducts.get(entry) + 1));
} else {
mapOfQuantityProducts.put(entry, 1);... | 2 |
public FlippingPuzzleDialog(final MainWindow mainWindow) {
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)... | 5 |
public static void main(String[] args) {
int i, j;
for(i=1; i<10; i++) {
for(j=2; j<10; j++) {
System.out.printf("%d*%d=%2d\t", j,i,i*j);
}
System.out.println();
}
System.out.println();System.out.println();
for(i=0; i<10; i++) {
for(j=0; j<10; j++) {
System... | 8 |
public static void newFile(String fileContent, String filePath, FileType fileType){
java.io.File file = new java.io.File(filePath + fileType.getType());
try {
FileWriter fw = new FileWriter(file);
fw.write(fileContent);
fw.close();
} catch (IOException e) {
log.error("Create file failed.");
e.print... | 1 |
public Document separateDocument(DocumentView docView) {
// Get the List that contains the DocView
List<Object> curDocAndDocView = null;
for (List<Object> value : this.docAndDocView.values()) {
if (value.contains(docView)) {
curDocAndDocView = value;
}
}
// Get the Document from this List
Document... | 4 |
static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable<?> unknown) {
Class<?> declaredByRaw = declaringClassOf(unknown);
// we can't reduce this further
if (declaredByRaw == null) {
return unknown;
}
Type declaredBy = getGenericSupertype(context, contextRawType, ... | 5 |
public static void changeTheme(String name) {
GUITHEME[] t = GUITHEME.values();
for (int i = 0; i < t.length; i++) {
if (t[i].name().equalsIgnoreCase(name))
theme = t[i];
}
} | 2 |
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.