method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1a102ec3-5782-43d8-865d-e8d02f2160b8 | 8 | private NumericRangeQuery(final String field, final int precisionStep, final int valSize,
T min, T max, final boolean minInclusive, final boolean maxInclusive
) {
assert (valSize == 32 || valSize == 64);
if (precisionStep < 1)
throw new IllegalArgumentException("precisionStep must be >=1");
this... |
46d47511-046f-4654-a665-0b19b2de38e3 | 2 | public void setFullness(double value) {
if (value < 0 || value > 1) {
throw new IllegalArgumentException(
"Illegal fullness, must me 0..1");
} else {
double oldVolume = getVolume();
fullness = value;
onFullnessChanged(oldVolume);
... |
d4c5c1ae-4f0e-49c5-a897-7b7d8171269d | 1 | public MainFrame() {
super("Pathfinding - A*");
try {
doAesthetics();
setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
} |
2a3fe249-30b7-4b56-8dbe-d21e1b5bd1c4 | 2 | private void openFile() {
JFileChooser chooser = new JFileChooser();
int choice = chooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
currentFile = chooser.getSelectedFile();
newFile();
MainImagePanel mip = MainImagePanel.getInstance();
currentFile = chooser.getSele... |
49233c75-26a3-495c-a933-bb34d6b6515f | 6 | public boolean checkChart(int[] morpheme, int morphemeLen, int tag, int phoneme, int nextPosition, int nextTagType, String str) {
for (int i = 0; i < morphemeLen; i++) {
Morpheme morph = chart[morpheme[i]];
if (morph.tag == tag &&
morph.phoneme == phoneme &&
morph.nextPosition == nextPosition &&
... |
3e29c972-a779-4dc6-9918-91d7ccd5a352 | 1 | public static void main(String[] args) {
Random rand = new Random();
TosserFactory[] tosserFactoriesArray = {new CoinFactory(), new DiceFactory()};
for (int i=1; i<20; i++) {
TosserFactory randTosserFactory = tosserFactoriesArray[rand.nextInt(2)];
Tosser randTosser = ra... |
878a97f0-81cc-46e6-8efc-898c252bd1f3 | 0 | public void mouseExited(MouseEvent arg0) {} |
f208a22d-171c-468d-b6fc-7146d96a8572 | 3 | @Override
public int compareTo(CardPower cp){
for (int i = 0; i < power.size(); i++) {
if(power.get(i) > cp.getAt(i))
return 1;
else if(power.get(i) < cp.getAt(i))
return -1;
}
return 0;
} |
eeb741bf-eb69-47f9-9a36-f5e95e977961 | 4 | private void processRMI(InputStream ins, OutputStream outs)
throws IOException
{
ObjectInputStream in = new ObjectInputStream(ins);
int objectId = in.readInt();
int methodId = in.readInt();
Exception err = null;
Object rvalue = null;
try {
Exporte... |
dd23e135-7599-45fb-9b32-709e8dda917a | 0 | public BinarySearch(int[] values) {
this.array = values;
} |
d5d00e77-a8c9-43b0-b087-2663d6882902 | 7 | public static Field resolveField(Class<?> inputClass, String fieldName) {
if (Class.class.equals(inputClass) || inputClass == null
|| inputClass.isInterface()) {
return null;
}
Field field = null;
try {
field = inputClass.getDeclaredField(fieldName);
field.setAccessible(true);
} catch (Securi... |
93ada38c-68d3-4261-a356-9959695d03e5 | 8 | @Override
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir + "BrokenPlainsBase.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) {
File imageFile = new File(Structure.... |
fec4a13c-9cba-466d-ba8d-19eb4623341b | 5 | @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChat(final AsyncPlayerChatEvent event) {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
final Player player = event.getPlayer();
World world = player.getWorld();
final String wo... |
62b8e60a-1d7e-458e-a6d3-abdd9740d309 | 9 | public void saveResource(String resourcePath, boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace('\\', '/');
InputStream in = getResource(... |
570db538-a731-4485-84f0-0248fa121e65 | 0 | public void setX(int a){
x = a;
} |
1a8c1d14-d01d-4524-a042-98f59ea6e2fa | 5 | public void printTableNormByLength() throws IOException{
System.out.println("printing the resulting expression table to " + outFile);
System.out.println("Normalize=" + normalize);
//BufferedWriter outReads = new BufferedWriter (new FileWriter(outFile));
TextFile outReads = new TextFile(outFile, true);
... |
b8a37ba7-3cb6-45d2-b2bf-578f1534b2e4 | 1 | private static boolean insertSchedule(Schedule bean, PreparedStatement stmt) throws SQLException{
stmt.setDate(1, bean.getWorkDay());
stmt.setTime(2, bean.getFrom());
stmt.setTime(3, bean.getTo());
stmt.setBigDecimal(4, bean.getHourRate());
stmt.setInt(5, bean.getVacationDays());
stmt.setString(6, bean.g... |
26411314-d8be-428a-b351-8939e632b804 | 2 | public static Currency getByNumber(final String token, final Long number) {
JSONArray fetchByNumber = null;
try {
fetchByNumber = fetchByNumber(token, object, number);
} catch (IOException e) {
e.printStackTrace();
}
List<Currency> formatOutputs = formatOutputs(fetchByNumber);
if (formatOutputs.size()... |
71563095-8057-4b01-bf5e-51b3cbc87447 | 4 | @Test
public void testArrayListLongLinear() {
long minTime = Long.MAX_VALUE;
long maxTime = Long.MIN_VALUE;
long avgTime = 0;
long beforeTime = 0;
long afterTime = 0;
long curTime = 0;
int value;
AbstractProcessor<Long> processor = new ValueFrequencyA... |
10cae28d-f30b-40dd-a890-4e78c01d426a | 7 | public DatosIteracion masCapturadas() {
DatosIteracion d = new DatosIteracion("auxiliar");
Lectura l = new Lectura(999999, 0, 0);
d.getValoresLecturas().add(l);
for (int i = 0; i < this.getValoresIteraciones().size(); i++) {
if (d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getCapturados()... |
cc439056-c509-47f2-afc4-41d9812f4404 | 0 | public Stack<IPaintable> getActions() {
return pegs;
} |
0b5a9dbd-02ab-45f4-ac84-1b15a22ec917 | 2 | boolean isCds(Variant seqChange) {
calcCdsStartEnd();
int cs = cdsStart;
int ce = cdsEnd;
if (isStrandMinus()) {
cs = cdsEnd;
ce = cdsStart;
}
return (seqChange.getEnd() >= cs) && (seqChange.getStart() <= ce);
} |
b83ff76c-eb30-4b07-b96b-9b8d4d768c20 | 4 | @Override
public void exportWrite(String path) {
double percent = 0;
int qntNodeEv = 0;
double lambda = 0;
Distribution distTraffic = null;
System.out.println("----------------------------------");
System.out.println("ConfSimulation");
System.out.println("----------------------------------");
try {
... |
fe8ddff1-6b6f-486c-9875-ac656f8548ab | 7 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((HistoryDate == null) ? 0 : HistoryDate.hashCode());
result = prime * result + ((favorite == null) ? 0 : favorite.hashCode());
result = prime * result + ((frequence == null) ? 0 : frequence.hashCode());
result = ... |
10a88f40-1ed8-49c8-a7e7-ac53f08e673e | 5 | public boolean keydown(KeyEvent ev) {
if (focusctl) {
if (focused != null) {
if (focused.keydown(ev))
return (true);
return (false);
} else {
return (false);
}
} else {
for (Widget wdg = c... |
759870cb-c75d-442e-98fa-b001016ea070 | 7 | @Override
public void paint(Graphics g) {
if (g == null)
throw new NullPointerException();
if (offscreenBuffer == null){
offscreenBuffer = createImage(this.getWidth(), this.getHeight());
offscreenGraphics = offscreenBuffer.getGraphics();
}
... |
3bdc9bc8-e24e-4832-b963-86d5d74e09e8 | 5 | public static String convert(ConvertParamsHolder cph) {
String url = URL + "?ajax=1&autodetect=1&font=1&_=1";
url += "&url=" + cph.getUrl();
if (cph.withImages()) {
url += "&img=1";
}
if (cph.withTables()) {
url += "&tab=1";
}
try {
... |
589c6b2f-1bd7-45aa-bbf1-4924b35a5af5 | 4 | @Override
public Pane getPane() {
gridPane = new GridPane();
FlowPane flowpane = new FlowPane();
flowpane.getChildren().add(gridPane);
gridPane.setStyle("-fx-font: bold 18pt \"Times New Roman\";");
gridPane.setHgap(5); gridPane.setVgap(5);
gridPane.getStyleClass().add("grid-pane-style");
gridPane.setS... |
2639c40b-a952-4c36-895f-ced6081d19b1 | 1 | public void trimToSize()
{
int [] trimmedArray;
if(data.length != manyItems)
{
trimmedArray = new int [manyItems];
System.arraycopy(data, 0, trimmedArray, 0, manyItems);
data = trimmedArray;
}
} |
a7a50215-0ef7-40bc-ae9e-fd66ddeb901d | 3 | public static String toBase64(String base) {
base = toBinary(base);
if (base.length() % SizeSix == 0) {
return holder(base);
} else if (base.length() % 6 == 2) {
base += "0000";
return holder(base) + "==";
} else if (base.length() % 6 == 4) {
base += "00";
return holder(base) + "=";
} else {
... |
1a664fa2-101f-47e2-8f9f-6b3cb3526f56 | 5 | private Class<?> getClassType(Class<?> classType){
if (classType == int.class) classType = Integer.class;
else if (classType == float.class) classType = Float.class;
else if (classType == boolean.class) classType = Boolean.class;
return classType;
} |
d9085d07-4854-4a4d-81f2-ae4f15acded9 | 9 | private static void createDecodeTables(int limit[], int base[], int perm[], byte len[], int minLen, int maxLen, int alphaSize) {
int pp = 0;
for (int i = minLen; i <= maxLen; i++) {
for (int i_ = 0; i_ < alphaSize; i_++) {
if (len[i_] == i) {
perm[pp] = i_;
pp++;
}
}
}
for (int i = 0; i ... |
32aa1be6-d375-4abb-a06e-8685916ecf17 | 1 | public boolean flowMayBeChanged() {
return jump != null || jumpMayBeChanged();
} |
360c35e1-393e-45d7-b6c9-d012d6fed566 | 8 | private short getNeighborAverage(int x, int y, byte color){
short average = 0;
if (x == 0){
if (y == 0){ //handles top left corner
average = getAverage(color,x,y,x,y+1,x+1,y,x+1,y+1);
}
else if (y == (getHeight() - 1)){ //bottom left corner
average = getAverage(color,x,y,x,y-1,... |
c13a179f-8813-4f4c-8f27-5470feacd693 | 7 | public Weather retrieveWeather(final int cityId) throws IOException, ParserConfigurationException, SAXException {
Weather result = new Weather();
final String url = "http://export.yandex.ru/weather-ng/forecasts/" + cityId + ".xml?" + generateRandomUrlTail();
InputStream inputStream = null;
... |
24b97fb5-fa39-4648-8d2c-84c010a6e442 | 2 | public void setDomain(String domain) {
if(domain.length() < 256) {
try {
isValidDomain(domain);
this.domain = domain;
} catch(Exception e) {
System.out.println(e.getMessage());
System.out.println("Domain not set.");
}
}
else
System.out.println("Domain part length must be less than 256 charact... |
45b7d90e-6c67-4baf-9db9-c8641f92a56f | 0 | public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
} |
3a14c8f9-221a-44bb-8114-c096446d1a1d | 4 | public static void main(String[] args)
{
EmulatorStart = new Date();
System.out.println(" .---. ");
System.out.println(" .--. | | ");
System.out.println(" .--./) |__| | |.-. ... |
f734c22a-08fa-42cf-8c53-cb9fb130f1b9 | 9 | public static void main(String args[]) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;){
long B=Long.parseLong(st.nextToken());
P=Long.parseLong(st.nextToken(... |
a8218883-d816-457b-aafa-7a2cb39a1ff6 | 5 | final void ia(short i, short i_381_) {
anInt5603++;
for (int i_382_ = 0; anInt5632 > i_382_; i_382_++) {
if (i == aShortArray5580[i_382_])
aShortArray5580[i_382_] = i_381_;
}
if (aClass118Array5621 != null) {
for (int i_383_ = 0; i_383_ < anInt5536; i_383_++) {
Class118 class118 = aClass118Array5621[i... |
38d97422-9caa-4c97-a735-c1ca93725ddf | 0 | public void setFilm(List<Film> film) {
this.film = film;
} |
510f47df-a425-477a-bdab-081db751e409 | 7 | void branch(P p) {
if(p.isInitdone()){
if (p.getVoisins().size()>=1) {
int sens = 1;
for(Map.Entry<Integer,ReaderWriter> entry : p.getVoisins().entrySet()) {
if(p.getPereO() != entry.getKey()){
stroke(255);
... |
1eb1d5af-6bb6-4560-900a-8f485fbeb57e | 0 | public Subtract(Expression left, Expression right) {
this.left = left;
this.right = right;
} |
97134235-72e4-408f-9753-f11592191004 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
8386905a-15d5-4a91-91e3-65ba647a9bdb | 4 | public void method563(byte arg0, int cache, int file) {
if (clientInstance.cacheIndices[0] == null) {
return;
}
if (files[cache][file] == 0) {
return;
}
byte abyte0[] = clientInstance.cacheIndices[cache + 1].get(file);
if (crcMatches(files[cache][f... |
b56ff8b7-55a0-48be-9011-bd8fa6dfd501 | 9 | public Editor() {
setLayout(new BorderLayout());
//create icons for tabs
ImageIcon textIcon = createImageIcon("/icons/darktext.png");
ImageIcon audioIcon = createImageIcon("/icons/darksound.png");
ImageIcon videoIcon = createImageIcon("/icons/video.png");
//define tabs
editorTabs.add(Text.getInstance());
... |
97d8f588-280f-4290-868b-4583ad1b56c2 | 4 | public static void main(String[] args) {
String[] colors = {"MAGENTA", "RED", "WHITE", "BLUE", "CYAN"};
List<String> list = new ArrayList<String>();
for(String color : colors) {
list.add(color);
}
String[] removeColors = {"RED", "WH... |
12c231ba-d386-44d6-9eba-ebee7557e26a | 7 | static final BinaryElementType.SlicedInteger.Slice parseIntegerSlice(ParseUtil.IndentableLexer lexer) throws IOException {
lexer.pass('@');
lexer.pass('.');
int rightShift = lexer.readUnsignedInteger("right shift");
lexer.skipSpaces();
BinaryElementType.SlicedInteger.Slice slice;... |
758b7f07-88f2-4057-b231-04191b192782 | 4 | private void clickCheckAll( int state ) {
int index;
JCheckBox checkbox;
if ( state == ItemEvent.SELECTED ) {
for ( index = 0; index < panelLimits.getComponentCount(); index++ ) {
checkbox = (JCheckBox) panelLimits.getComponent( index );
checkbox.setEnabled( false );
... |
f39b60f3-a159-4aee-99c4-e72cc2d800ff | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE>... |
21fd3b6b-ff78-4cdf-9d41-1382cb776e6e | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Moves other = (Moves) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... |
9509e9b5-af15-418b-8c0d-134c5e2446d9 | 5 | public static void sort(int[] a, int amountOfPossibleNumbers) {
int k = amountOfPossibleNumbers + 1;
int[] c = new int[k];
int[] b = new int[a.length];
/**
* Init array c
*/
for (int i = 0; i < k; i++) {
c[i] = 0;
}
/**
* ... |
d7b2b071-62f7-49c4-9706-5ecda3207fa0 | 4 | public Spherical Dc62s(Cartesian v) {
double x, y, z, xd, yd, zd, rxy2, rxy, r2, xyp;
double a, b, r, ad, bd, rd;
TRACE("Dc62s");
/* Components of position/velocity vector. */
x = v.getX();
y = v.getY();
z = v.getZ();
xd = v.getXvel();
yd = v.getY... |
ab97003a-2129-4629-b561-49efed7e0e32 | 1 | public int getCount() {
if (mSelection.length() > mSize) {
// If the last selected index was outside our valid range, we create
// a new BitSet that only contains bits in our valid range.
mSelection = mSelection.get(0, mSize);
}
return mSelection.cardinality();
} |
a363f815-2356-4449-8194-66874acd1edc | 8 | private String syncToneHunt (CircularDataBuffer circBuf,WaveData waveData) {
int difference;
// Get 4 symbols
int freq1=crowd36Freq(circBuf,waveData,0);
// Check this first tone isn't just noise
if (getPercentageOfTotal()<5.0) return null;
int freq2=crowd36Freq(circBuf,waveData,(int)samplesPerSymbol*1... |
07bd94c9-2547-4fd9-b589-72e4cbe356eb | 0 | @Override
public void rotateY(int angle) {
base = DimensionalTrasform.rotateY(angle, base);
setColoredExes();
} |
1f48cf51-5679-41a2-bc81-f0003a74c729 | 1 | public void setSelectedIndex(int i) {
if (NoE() > i) {
table.setRowSelectionInterval(i, i);
}
scroll(i);
} |
4755afd3-ecab-4384-aff5-488cde62be77 | 6 | public boolean onRightClick(Entity entityClicked, GameScreen screen, InputHandler input){
if(entityClicked == this){
OptionsPopup popup = new OptionsPopup(input, this);
Option option2 = new Option("Add campfire"){
public void onClick(){
map.addEntity(new CampFireStructure(map, xPos, yPos - 1, tribe));
... |
a236f888-981e-49fe-94ca-b587d655d2a5 | 6 | @Override
public int count() {
String query = "SELECT COUNT(id) AS nb FROM computer";
ResultSet results = null;
int count = 0;
Connection connect = ConnectionMySql.getInstance();
try (Statement stmt = connect.createStatement()){
results = stmt.executeQuery(query);
while (results.next()) {
... |
64c513b7-76f4-46d1-9c34-e0db590712f0 | 3 | private void initActionListeners() {
// wird aufgerufen, wenn der Datei...-Button geklickt wird
// das Textfeld wird dann mit dem Dateipfad versehen
fileChooserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (chooser.showOpenDial... |
fab29101-6c83-4f5f-a8a2-c02b0a7ef4c5 | 9 | private float headTowards(float x, float y) {
/*
* use cross product to see if we need
* to turn left or right. return true if
* we are 'at' the point.
*/
Vector3d u = new Vector3d(x - flyingDot.p.x, y - flyingDot.p.y, 0);
Vector3d v = new Vector3d(flyingDot.v... |
07f508ea-413c-4105-99a8-b3cd25d508cf | 5 | public static int GCD(int input1, int input2) {
if(input1==0||input2==0) {return 0;}
if(input1<0||input2<0) {return -1;}
int remainder;
while((remainder=input1%input2)!=0) {
input1 = input2;
input2 = remainder;
}
return input2;
} |
3823d8eb-0c01-43ef-a099-77208b862a5d | 8 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
if (!Room.CheckRights(Main.Data, true))
{
return;
}
... |
8a2abbf1-bcab-466a-bb2c-6d4056160aef | 7 | private String principalComponentsSummary() {
StringBuffer result = new StringBuffer();
double cumulative = 0.0;
Instances output = null;
int numVectors=0;
try {
output = setOutputFormat();
numVectors = (output.classIndex() < 0)
? output.numAttributes()
: output.numAttr... |
91ec7527-5a7f-41d1-9706-0218cdafa418 | 0 | @Override
public String toString(){
return "" + this.weaponItem.toString();
} |
13f39ec1-60be-4838-b9ae-8945572394b2 | 4 | public File getFile() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getFile() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getFile() END");
}
return m_inFile;
} |
beb8bf1d-49c7-49dc-b86a-17b70c57aee6 | 8 | public static String formReturn(int file,int rank)
{
String converted=null;
switch(file)
{
case 0: converted = "a"+Integer.toString(rank);
break;
case 1: converted = "b"+Integer.toString(rank);
break;
case 2: converted = "c"+Integer.toString(rank);
break;
case 3: converted = "d"+Integer.toStr... |
5c6e68ca-8a20-4387-897d-8914a8ad1ec0 | 1 | static String prettyPrintWithXMLSerializer(Document document) {
try{
StringWriter stringWriter = new StringWriter();
OutputFormat format = new OutputFormat(Method.XML, "UTF-8", true);
format.setIndent(2);
XMLSerializer serializer = new XMLSerializer(stringWriter,f... |
512a3c79-376f-468f-92f5-4a33e710b356 | 4 | public void updatePlat2(int k, Character plat) {
// manages horizontal moving platforms
Platform tempPlat2 = (Platform) plat;
int tempx1 = tempPlat2.getX();
int tempv = tempPlat2.getHV();
if (tempv == 2) {
tempPlat2.changeX(tempv);
if (tempx1 > 400) {
tempPlat2.setHV(-2);
}
}
if (tempv ==... |
fb2ac561-add1-4bfe-ac03-0074b4a73826 | 8 | private void setupDamageForce(){
controlplayer.BasicInfo bi = spatial.getControl(controlplayer.BasicInfo.class);
if(commands == AnimationCommands.KICK1){
damage = 4 + bi.getDamage();
push_Force = .5f;
}else if(commands == AnimationCommands.PUNCH1){
da... |
76d7bacb-da76-4dbb-9ae0-0c6d0b341d7f | 8 | private boolean r_factive() {
int among_var;
// (, line 132
// [, line 133
ket = cursor;
// substring, line 133
among_var = find_among_b(a_7, 2);
if (among_var == 0)
{
... |
880aa68b-9394-4a0a-ac12-6c7fd9b9c4e6 | 3 | private static Move BackwardLeftForBlack(int r, int c, Board board){
Move backwardLeft = null;
assert(board.cell[r][c].equals(CellEntry.blackKing));
if(r<Board.rows-1 && c<Board.cols-1 &&
board.cell[r+1][c+1] == CellEntry.empty
)
{
backwardLeft =... |
6de615f9-b962-476f-9a4a-c71dc09b4c0d | 5 | @Override
protected void removeDefeatedRulesWithInference(Set<String> defeatedRulesStr, boolean checkInference) throws ReasoningEngineException {
try {
List<Rule> defeatedRules = new ArrayList<Rule>();
for (String ruleLabel : defeatedRulesStr) {
Rule rule = theory.getRule(ruleLabel);
defeatedRules.add(... |
9143b727-fb95-4037-a352-bde0a8f47e9d | 6 | public static int titleToNumber(String s) {
int i = 0;
while (s.charAt(i) == ' ') i++;
long res = 0;
int len = s.length();
if (i == len) return -1;
while (i < len) {
char c = s.charAt(i);
if (c < 'A' || c > 'Z') return -1;
res = res * 2... |
1e176716-2d1a-44d1-82c4-6971ede7efa3 | 4 | @Override
public boolean importData(TransferSupport support) {
boolean accept = false;
if (canImport(support)) {
try {
Transferable t = support.getTransferable();
Object value = t.getTransferData(RiverComponent.RIVER_COMPONENT_DATA_FLAVOR);
... |
c5a792d1-a47b-4471-8983-8ae5ab35c5f5 | 8 | public static void extractFromHTML(String theURL) throws URISyntaxException,
ParserException, IOException {
URL url = new URL("file:" + theURL);
URLConnection con = url.openConnection();
Pattern p = Pattern.compile("text/html;\\s+charset=([^\\s]+)\\s*");
Matcher m = p.matcher... |
0d4e60c8-8807-4d79-ba54-ea1bf7f12a74 | 3 | public int variant() {
if (variant < 0) {
// This field is composed of a varying number of bits
if ((leastSigBits >>> 63) == 0) {
variant = 0;
} else if ((leastSigBits >>> 62) == 2) {
variant = 2;
} else {
variant = (int)(leastSigBits >>> 61);
}
}
return... |
fef384bf-f58a-4c75-8b13-356b9300cde7 | 8 | public String nextLevel(String s) {
if (level == levels.level1) {
level = levels.level2;
} else if (level == levels.level2) {
level = levels.level3;
} else if (level == levels.level3) {
level = levels.level4;
} else if (level == levels.level4) {
level = levels.level5;
} else if (level == levels.le... |
f1515a84-80a9-425b-9993-8bbd253f9543 | 2 | public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc=new Scanner(System.in);
int temp = sc.nextInt();
int a, b,c, sum;
for (int i = 0; i < temp;i++)
{
... |
bed64e1f-b6f5-491e-b5bd-6af43452c369 | 7 | public void writeRarifiedSpreadhseet(File filepath, boolean withReplacement, int depth) throws Exception
{
Random random = new Random(24231);
int minIndex = getSampleIdWithMinCounts();
int rarificaitonDepth = depth;
if( depth <= 0)
{
depth = getCountsForSample(minIndex);
}
BufferedWriter w... |
2a5cd9ae-ddf1-42fe-985e-3099fe577127 | 2 | protected static Map elementsToText(Node node) {
NodeList children = node.getChildNodes();
Map e2t = new java.util.HashMap();
for (int i = 0; i < children.getLength(); i++) {
Node c = children.item(i);
if (c.getNodeType() != Node.ELEMENT_NODE)
continue;
String elementName = ((Element) c).getTagName()... |
7fd1745c-18a5-430f-ba45-98a3477a0159 | 0 | public void setSizeOfProducts(Integer sizeOfProducts) {
this.sizeOfProducts = sizeOfProducts;
} |
87215c5c-d664-4fe8-9ed4-3f8f8b0f9e95 | 1 | public void MostarToken() {
for (Token token : this.listaToken) {
// System.out.println(token.getLexema() + " => " + token.getValor_token());
}
} |
69332482-af4f-4a47-89cf-06df9ea20107 | 8 | public void renderItem(int xp, int yp, Sprite sprite) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < sprite.HEIGHT; y++) {
int ya = y + yp;
int ys = y;
for (int x = 0; x < sprite.WIDTH; x++) {
int xa = x + xp;
int xs = x;
if (xa < -16 || xa >= width || ya < 0 || ya >= height) break;
... |
18f90a9d-60fb-4cb1-8212-67d6d81b4fdb | 0 | public void printChildren(Graphics g) {
} |
064a8f99-6a6e-4a7d-a319-6067dc9aa547 | 4 | public Urun getUrun(HashMap<String, String> values){
try {
int barkod = Integer.parseInt(values.get("barkod"));
int stok = Integer.parseInt(values.get("stok"));
double birimFiyat = Double.parseDouble(values.get("birimFiyat"));
String urunAdi = values.get("urunAdi"... |
f9b277d3-1024-4def-bdb0-c66a165aef0e | 2 | public boolean contains(Item item)
{
for (Node t = first; t != null; t = t.next)
if (item.equals(t.item))
return true;
return false;
} |
b0935f5b-4d3b-419f-836e-db2c5aa7839a | 6 | public static void main(String argv[]) throws Exception {
int port = Integer.parseInt(argv[0]);
String filename = argv[1];
DatagramSocket serverSocket = new DatagramSocket(port);
byte[] receiveData = new byte[1024];
byte[] sendData = new byte[3];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
... |
db90e113-e523-49b4-8297-4f7f8bb8073c | 6 | public void putSaveData(CellState[][] cdata){
FileOutputStream fos = null;
ByteArrayInputStream bis = null;
try{
byte[] buffer = new byte[2048];
String[] data = statesToBits(cdata);
fos = new FileOutputStream(save);
for(String s: data){
bis = new ByteArrayInputStream(s.getBytes());
for(int c =... |
768080f3-b115-4fbf-a01b-43418efd5312 | 1 | public void createBestParamData() {
bestParamData = new ParameterData[paramData.length];
for (int i = 0; i < bestParamData.length; i++) {
bestParamData[i] = new ParameterData(paramData[i]);
}
} |
14d17d4b-3ee7-4337-b6c0-4af10acd3cdf | 8 | private int negxL(int dest) {
clearFlags(SR_X, SR_N, SR_V, SR_C);
int result = -dest - (isExtendedSet() ? 1 : 0);
if (msbSetL(result)) setFlag(SR_N);
if (!isZeroL(result)) clearFlag(SR_Z);
if (msbSetL(dest) && msbSetL(result)) setFlag(SR_V);
if (msbSetL(dest) || msbSetL(result)) setFlag(SR_C);
... |
9cd89c79-5552-45ff-a98b-b34bc3b58fea | 2 | private void resetSeason() {
int response = JOptionPane.showConfirmDialog(null,
"Would you like to delete current season?", "Reset Season",
JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
try {
GameData.getCurrentGame().endCurrentGame();
m.getJMenuBar().removeAll();
m.di... |
1c125cb0-3d55-4195-bb77-bdc0ae188334 | 2 | public String generaTabla(ArrayList<Equipo> equipos) {
String tabla = "<table id='tablaResultado'>\n";
tabla += "<tr>\n";
tabla += "<th>Num. Inv. interno</th> <th>Num. Inv. UNAM</th> <th>Marca</th> <th>Modelo</th>"
+ "<th>Serie</th> <th>Familia</th> <th>Tipo</th> <th>Fecha de re... |
c2795ce5-656f-4cb2-8d2f-e5a471cd7b73 | 7 | private void addNodeToARG(Node child, List<ARGNode> argNodes) {
if (child.getNodeName().equalsIgnoreCase(XML_NODE)) {
String id = getAttributeForNode(child, XML_ID);
String heightStr = getAttributeForNode(child, XML_HEIGHT);
double height = Double.parseDouble(heightStr);
String annotation = getAttributeFo... |
3dbcbdf1-1798-424c-93e6-046a1e1fe0d9 | 3 | private OutEdgeIteratorImpl(InternalNodeWrapper<N, E> from, ContextualReachability<N, E, ?> contextualReachability) {
List<InternalNode<N, E>> reachableNodes = new ArrayList<InternalNode<N, E>>();
for (InternalNode<N, E> node : from.toNodes) {
if (contextualReachabi... |
6d0649cf-fe5b-4354-92e8-9a6f4ec5d919 | 3 | public int clearRows()
{
int cleared = 0;
for (int i = 0; i < height; i++)
{
if(getRowCount(i) >= width)
{
cleared++;
for(int j = 0; j < width; j++)
{
System.arraycopy(grid[j... |
2dd843fc-1f40-4031-8fbb-fdffde8cff04 | 5 | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Card card = (Card) o;
if (title != null ? !title.equals(card.title) : card.title != null) {
... |
d196b863-1a88-4bd2-acd6-500dccfa703e | 5 | public static ArrayList<BookCopy> getAllCopies() {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<BookCopy> bookList = new ArrayL... |
55f2bf40-7125-4ae0-a899-0a85e67d5af9 | 9 | public void searchAvailableCells(){
for (int i = 0; i < 8; i++) {
switch (i) {
case 0:
this.testAvailabe(-1, 2, i);
break;
case 1:
this.testAvailabe(-1,-2, i);
break;
case 2:
this.testAvailabe(-2, 1, i);
break;
case 3:
this.testAvailabe(-2, -1, i);
break;
case 4... |
d8283554-c703-48b0-8d39-bba91383f2dc | 1 | public void copy(LinkedList<T> data) {
LinkedList<T> list = new LinkedList<T>();
for (Refer i = data.top; i != null; i = i.next) {
list.add((T) i.term);
this.add(list.remove());
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.