method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8f29eba5-3438-4b55-82b3-70188e7ec226 | 8 | public void initTraining(){
//by Budhitama Subagdja
int previdx = 0;
int diffidx = 0;
int maxseqlimit = SEQLENGTH;
if(events.isEmpty()){
System.out.println("ERROR: EMPTY EVENT SET!!");
return;
}
int seqcount=0;
int curSeqLen=0;
seqStartIndexes = new ArrayList();... |
0cb9d99e-8534-4e33-9a5a-0b0557152bff | 5 | public int[] plusOne(int[] digits) {
if ((digits[digits.length - 1] + 1) < 10) {
digits[digits.length - 1] += 1;;
return digits;
} else {
for (int i = digits.length - 1; i >= 0; i--) {
if ((digits[i] + 1) == 10) {
digits[i] = 0;
... |
6d73a1d1-2e30-4007-82f5-1ab3b590ba63 | 6 | public void followPlayer(Rachel r){
if(seePlayer(r)){
follow++;
}
if(follow > 0){
if(r.getY() > getY()){
setDown(true);
} else {
setDown(false);
}
if(r.getY() < getY()){
setUp(true);
} else {
setUp(false);
}
if(r.getX() < getX()){
setLeft(true);
} else {
se... |
7ac20acf-2263-4e8d-9283-9dc0285bf189 | 7 | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException
{
LOGGER.info("message received");
String ip = req.getRemoteHost();
String result = "";
InputStream is = null;
OutputStream os = null;
try
... |
fc157cc4-9821-42ef-b679-a6f73c437ddc | 6 | private static int askForNumberBetween( String question, int min, int max ) {
println( question );
while( scanner.hasNext() ) {
try {
int number = Integer.parseInt( scanner.next() );
if( number>=min && number<=max ) {
return number;
} else if( number<min ) {
println( "Sorry, this number is ... |
6cbb2359-816b-4d0f-acb4-087d1d61ec68 | 0 | public int getDepartureStop() {
return this._departureStop;
} |
f5c7a686-288c-4791-81b9-1b98a333490b | 9 | protected AttributeSet[] getAttributeSets(String use, List list)
throws XPathException {
if (list == null) {
list = new ArrayList(4);
}
XSLStylesheet stylesheet = getPrincipalStylesheet();
List toplevel = stylesheet.getTopLevel();
StringTokenizer st = n... |
53a04692-4d99-41fc-880c-de155dd0ec32 | 9 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (input.hasNext()) {
int num = input.nextInt();
if (num == 1) {
System.out.println("Jolly");
continue;
}
boolean[] isJolly = new boolean[num];
boolean jolly = true;
int left = input.nextInt();
int... |
36f5ff45-0dab-46f1-ad6e-0d40dd8cd95f | 2 | public void union(GoTerm goTerm) {
if( symbolIdSet != null ) symbolIdSet.addAll(goTerm.symbolIdSet);
if( interestingSymbolIdSet != null ) interestingSymbolIdSet.addAll(goTerm.interestingSymbolIdSet);
} |
5fb0f3eb-bebe-4904-aafb-b38087bda4fd | 2 | @Override
public EntityPlayer loadTexture()
{
try
{
texture = TextureLoader.getTexture("PNG", new FileInputStream("./res/" + unlocalized_name + ".png"));
animation.put(Direction.FRONT, texture);
}
catch (Exception e)
{
try
{... |
22f9ae36-e6e5-4dce-8113-c81cd5e484db | 3 | @Test
public void testGitHubPropertiesHome() {
MavenProperties properties = new MavenProperties("~/.m2/settings.xml");
try {
properties.fetchProperties();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace()... |
70eeeab4-d019-4384-9eb3-b4e3d45630d6 | 1 | @Override
public void logicUpdate(GameTime gameTime) {
// Update the current state
currentState.logicUpdate(gameTime);
// Attempt to change the current state to the offered transition state
// if it is not null, and it exists within the system
if (currentState.getTransitionStateName() == null) {
// This s... |
6d69538d-cca2-47d1-9444-a5eca8e8dddd | 2 | public static void scrollBothPaneH(String str, int delta) {
if (str == "inc") {
scrollPane1.getHorizontalScrollBar().setValue(scrollPane1.getHorizontalScrollBar().getValue() + delta);
scrollPane2.getHorizontalScrollBar().setValue(scrollPane2.getHorizontalScrollBar().getValue() + delta);
... |
de17187d-319d-4ecb-8e71-30745462932d | 3 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
// we start out disabled
setEnabled(false);
// Add us to our parent menu.
((JMenu) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2)).add(this);
// set size of Recent Files list
currentRecentFilesList... |
3bf2046b-0ae3-4478-8676-b063c126fcf5 | 0 | @Override
public void compute() {
} |
647279ef-9067-472d-8534-8c962c5e4ea4 | 1 | public static void main(String[] args) throws IOException {
String fileToRead = "../data/test_set_tweets.mini.txt";
Corpus c = new Corpus(new Parser(fileToRead));
System.out.println("CORPUS CREATED");
Generator g = new Generator(c);
for(int i = 0; i < 500; i++){
String gs = g.createSentence();
Syst... |
0cee6418-500d-4a56-8c22-1c405f4db12e | 1 | public static void updateArticle(int id,int idCouleur,int idtva,String libelle,String reference,float prixht, int photo) throws SQLException {
String query;
try {
query = "UPDATE ARTICLE set ID_COULEUR=?,ID_TVA=?,ARTLIBELLE=?,ARTREF=?,ARTPRXHT=?,ARTPHOTO=? WHERE ID_ARTICLE=? ";
... |
e4a95514-2527-4ac7-80a0-36de6ce38a66 | 1 | public static void main(String[] args) {
try {
runProcess("javac C:\\Users\\Adam\\workspace\\Main.java");
runProcess("java -cp C:\\Users\\Adam\\Desktop Main");
} catch (Exception e) {
e.printStackTrace();
}
} |
f0a2537d-bd60-4d8c-9c8c-1bd8b8f13558 | 3 | public int returnHighestBin () {
try {
int a,highBin=-1;
int highVal=Integer.MIN_VALUE;
for (a=0;a<circBufferCounter;a++) {
if (circDataBuffer[a]>highVal) {
highVal=circDataBuffer[a];
highBin=a;
}
}
return highBin;
}
catch (Exception e) {
JOptionPane.showMessageDialog(null,"Err... |
be03576b-664f-464f-b873-c868033d5ca2 | 6 | @SuppressWarnings("deprecation")
public boolean start()
{
synchronized (optOutLock)
{
// Did we opt out?
if (isOptOut()) { return false; }
// Is metrics already running?
if (taskId >= 0) { return true; }
System.out.println("METRICS STARTING");
// Begin hitting the server with glorious data
... |
7925efad-ab2c-4c50-9d56-644aade50368 | 2 | private void showFileOpenDialog(){
JFileChooser fileOpen = new JFileChooser("./");
// FileNameExtensionFilter filter = new FileNameExtensionFilter(
// "Algorythm workspace files .wks", "wks");
// fileOpen.setFileFilter(filter);
int ret = fileOpen.showDialog(null, "Open file"... |
cec93c5d-c9d9-4fb1-8242-c383c99391ed | 2 | private void giveTreasurePoints() {
for (int i = 0; i < bombers.length; i++) {
if (bombers[i].getTile() != null) {
bombers[i].getTile().collectTreasure();
}
}
} |
28fd3124-821c-40c5-9790-63ef1c38351f | 3 | public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // ID
return ID;
case 2: // NAME
return NAME;
case 3: // PRICE
return PRICE;
default:
return null;
}
} |
de48ff17-e32b-48f0-83e1-18dd6b565cd9 | 5 | private static void handleInput(int nGramLength) {
NGramWrapper ngw = new NGramWrapper(nGramLength);
ngw.readFile(new File("/Users/JAsketorp/Documents/DD2380/smsCorpusAsText.txt"));
System.err.println("Corpus:");
System.err.println("Number of sentences: "+ngw.numberOfSentences);
... |
b6ae684f-9b13-4497-8aa9-e4b4a9e1e514 | 5 | public void checkShipInBox(){
// If the pirate ship is in the red box
if(checkedAlready)
{
if( (pirateShip.getxCoord() < (boxX+(boxWidth-95)) &&
pirateShip.getxCoord() > boxX) &&
(pirateShip.getyCoord() < boxY+(boxHeight+20) &&
pirate... |
ddfe2b3e-27bc-484a-9aac-eefe1804a81f | 0 | @Override
public void master() {
log.debug("master");
} |
2da6347c-43ca-4da5-86a0-d2c8f68018a7 | 0 | public static void main(String[] args) {
// 多态创建建造者(部件)
Builder builder = new ConcreteBuilder();
// 根据建造着实例化指导者 (构建过程)
Director director = new Director(builder);
// 利用指导者来创建
director.construct();
// 表现
Product product = builder.getResult();
System.out.println(product);
System.out.println(product.get... |
318d3bfb-91bd-4337-814a-d2a821417fb3 | 5 | public static void main(String args[]) throws InterruptedException {
// Delay, in milliseconds before
// we interrupt MessageLoop
// thread (default one hour).
long patience = 1000 * 60 * 60;
// If command line argument
// present, gives patience
// in seconds.
... |
30db12fe-60aa-4e25-90f8-74cac743f1bf | 6 | public static void main(String[] args) throws IOException {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://127.0.0.1:3306/export";
String user = "root";
String password = "root";
/**
* Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnect... |
2608f885-8978-47c6-b3ce-000694ffe867 | 9 | private void runExperiment1(int[] query) {
System.out.print("How many rounds you want? ");
int round = scanner.nextInt();
SGM sgm = new SGM();
TJSGM tjsgm = new TJSGM();
PRM prm = new PRM();
long[][][][] result = new long[3][round][query.length][4];
for (int j = 0; j < round; j++) {
for (int i = 0; i <... |
208d5459-4d29-4aee-994b-b096a3cf860b | 1 | public String getFromToString() {
River r = trip.getRiver();
if (r == null) {
return "<?> \u25BA <?>";
}
return r.getTripFrom() + " \u25BA " + r.getTripTo();
} |
390817aa-efd4-42dd-a0e1-1552e713c68e | 6 | public static boolean isChunkIDEuqal(byte[] one, int oneOffset,
byte[] another, int anotherOffset) {
if (one != null && another != null
&& one.length >= 4 + oneOffset
&& another.length >= 4 + anotherOffset) {
... |
3e9870db-6b02-41b5-8422-68f259f9a52f | 8 | static final int method3958(int i, Class68 class68, Class304 class304) {
if (class68 == Class68.aClass68_1183) {
if (AbstractMouseEvent.aClass304_7103 != class304) {
if (Class108.aClass304_1662 == class304)
return 21;
if (Class348_Sub40_Sub38.aClass304_9471 == class304)
return 28;
if (Class34... |
362deaab-3273-4410-8227-80f2fef3cb85 | 1 | private void checkPruned(String method) {
if (wasPruned)
throw new RuntimeException(method + "(): " + getName()
+ " was pruned.");
} |
cb5fdf36-3efc-44e4-bf40-d0ff022b044e | 0 | public void setDocument(Document doc) {this.doc = doc;} |
abf6d607-c013-4a69-a447-b71286c3882f | 3 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Use /title ? for help.");
return true;
}
try {
if (!cmdMap.dispatch(sender, args)) {
sender.sendMessage(ChatColor.RED + "Unknown com... |
9ea6fb01-e3b9-4ed1-b98e-e27b2778ad41 | 2 | private int findFreeId() {
for (int i=0; i<corridors.length; i++) {
if (corridors[i] == null) { //check if null's have to be put
return i;
}
}
int onGoingId = corridors.length;
doubleSize();
return onGoingId;
} |
2cce50c5-987d-4513-ab96-d9e57485825b | 2 | public Tile getTile(int id) {
if (id < 0 || id >= tiles.length)
return Tile.VOID;
return tiles[id];
} |
cb2484da-3e44-4388-a3bb-7a8b1fac5f4c | 3 | @Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
if (!Configuration.isRequestFromTaskQueue(req, resp)) {
return;
}
String devicesJSon = req.getParameter("devices");
if (devicesJSon == null) {
log.warning("Missing 'devices' argument on tas... |
fe202965-1a5d-45d7-970f-55f1b33a45c9 | 0 | public int getAge() {
return age;
} |
ae1e082b-b1a0-4f38-9974-16a081cc87ba | 8 | public static void readConfig() {
try {
if(curDir.exists()) {
BufferedReader in = new BufferedReader(new FileReader(curDir));
String inLine;
for(; (inLine = in.readLine()) != null;) {
String[] parseVar = inLine.split(":");
if(parseVar[0].startsWith("eUser"))
setEmailUser(pa... |
423e4b59-e9d2-4ae1-8306-ef81b93bbe48 | 8 | protected Object instanceToArray(Instance instance) throws Exception {
int index;
int count;
int i;
Object result;
// determine number of non-zero attributes
count = 0;
for (i = 0; i < instance.numValues(); i++) {
if (instance.index(i) == instance.classIndex())
c... |
7b2c3ca9-c72d-472e-a675-bf908c766299 | 4 | @Test
public void testReceiveMultiple() {
int noOfMessages = 5;
try {
consumer = new AbstractMessageConsumer(mockTopic) {
};
assertNotNull(mockTopic.getTopicSubscriber());
HashSet<Message> messages = new HashSet<Message>();
for (int i = 0; i < noOfMessages; i++) {
Message msg = new MockMessage(... |
947cf402-5269-4827-84ae-d6e08f61b2b5 | 2 | public void delete(int idEntidadBancaria){
try{
String deleteEntidad = "DELETE FROM entidadBancaria where idEntidad = ?";
Connection connection = connectionFactory.getConnection();
PreparedStatement prepared = null;
prepared = connection.prepareStatement(deleteEntidad);
p... |
6c9e4c0b-ce6c-4a63-aea9-d1302deb334b | 2 | @FXML
private void handleMenuSuppliers(ActionEvent event) {
final Node pos = rootPane.getChildren().get(0);
if (pos.getId().equals("borderPaneRegister")) {
return;
}
final Region registerItem;
try {
registerItem = FXMLLoader.load(PosApplication.class.... |
34a59c52-7a13-40b1-987d-1d86ebdadf17 | 2 | @Override
int utrDistance(Variant seqChange, Transcript tr) {
int cdsStart = tr.getCdsStart();
if (cdsStart < 0) return -1;
if (isStrandPlus()) return cdsStart - seqChange.getEnd();
return seqChange.getStart() - cdsStart;
} |
0d45b2af-30b3-4f54-88b4-5efad2f7f4bc | 6 | private Comparison.Op cmp_op() {
switch (peekType()) {
case LT:
consume(LT);
return Comparison.Op.LT;
case LE:
consume(LE);
return Comparison.Op.LE;
case EQ:
consume(EQ);
return Comparison.Op.EQ;
case GE:
consume(GE);
return Comparison.Op.GE;
case GT:
consume(GT);
return Compar... |
dc36f0d5-d9d3-48e8-8510-26c6f90b165f | 4 | @Override
public boolean equals(Object ob)
{
if(ob instanceof Poblacion) {
Poblacion p = (Poblacion)ob;
//if(this.individuos.length != p.individuos.length) {
if(this.indi.size()!=p.indi.size()) {
return false;
}
//int n = this.i... |
09bd30d3-cab2-4204-8efd-2e77c72955c3 | 3 | protected int emptyNeeded() {
State[] states = automaton.getStates();
int needed = 0;
for (int i = 0; i < states.length; i++)
for (int j = 0; j < states.length; j++)
if (automaton.getTransitionsFromStateToState(states[i],
states[j]).length == 0)
needed++;
return needed;
} |
1ad720e1-6878-451c-84bb-3a5478687085 | 2 | @Test
public void testLongCoding() {
class Valider {
byte[] buf = null;
void valid(long l) {
buf = BytesUtils.encodeLong(l);
long bl = BytesUtils.decodeLong(buf, new Offset());
if (bl != l) {
System.err.println(String.format("Wrong with %d while bl = %d, and buf = %s", l, bl
, Arrays.to... |
0ecf3a36-f5dc-424c-aac5-269dcd47ce96 | 1 | public float getTexHeight() {
if(animation != null) {
return animation.getFrameHeight();
}
return tex.getHeight();
} |
8daa61bb-5aba-4aee-83ce-026a436fb08e | 6 | public void disposeEditors(String editor){
// Dispose the editor do it doesn't leave a ghost table item
if(actionEditor.getEditor() != null && ((editor.equals("action") || editor.equals("all"))))
actionEditor.getEditor().dispose();
if(matchEditor.getEditor() != null && ((editor.equals("match") || editor.equ... |
3550b540-2bb7-4416-9d86-bcf8865ff2a6 | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((compartment == null) ? 0 : compartment.hashCode());
result = prime
* result
+ ((hasOnlySubstanceUnits == null) ? 0 : hasOnlySubstanceUnits
.hashCode());
result = prime * result + ((id == n... |
5223a777-82fa-48bc-a66d-9387313bcfb4 | 0 | @Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
} |
46e3e104-fc6b-41cf-ab8d-c98345f98425 | 2 | @Override
public int compare(Integer index1, Integer index2) {
// TODO Auto-generated method stub
if(map.get(index1) < map.get(index2)){
return 1;
}else if(map.get(index1) == map.get(index2)){
return 0;
}else{
return -1;
}
} |
c1f3d780-f5c1-4977-8084-c22bc1925c19 | 7 | @Override
public StaticChoice askChoice(boolean cancel) {
String playerName = control.getPlayer().getName();
System.out.println(playerName + ", " + promptMessage);
int choice = -1;
List<StaticChoice> choices = new ArrayList<>();
choices.addAll(Arrays.asList(control.getMenuName().getChoices()));
choices.re... |
9648e715-27b8-4e3f-a033-2193aa83539b | 8 | public void setSecretAlphabeticCipher(String secretAlphabeticCode) {
secretAlphabeticCode = secretAlphabeticCode.toLowerCase();
StringBuffer sb = new StringBuffer(secretAlphabeticCode);
for (int z=0; z<sb.length(); z++) {
char buchstabe = sb.charAt(z);
for (int i... |
0bed49e2-672e-48a6-8c15-54fcd5d77b0f | 2 | public boolean compareUserList(ArrayList<User> userList) {
for (int i = 0; i < usersDecryptedTable.size(); i++) {
if (!usersDecryptedTable.get(i).getID()
.equals(userList.get(i).getID())) {
return false;
}
}
return true;
} |
c251ba9e-f362-43a7-acb9-e5950b9312e9 | 3 | private boolean verify_IN_Hierarchy(boolean conclusion, Set<Node> toVerifyNodes, Set<Node> verifiedNodes) {
final Iterator itr = toVerifyNodes.iterator();
Node cur = (Node) itr.next();
toVerifyNodes.remove(cur);
if (verifiedNodes.contains(cur)) {
conclusion = false;
... |
d14979fc-5c3f-4bb1-a45a-f87b43de5aea | 3 | private NoeudArbre rechercheClefList(E clef) {
NoeudArbre<E> result = NIL;
int i = 0;
while (result == NIL && i < listNoeudArbres.size()) {
if (listNoeudArbres.get(i).clef.compareTo(clef) == 0) {
result = listNoeudArbres.get(i);
}
i++;
... |
41b5228b-e278-40f4-9525-73ce259d0fbe | 4 | public boolean equals(Stats stats)
{
return stats != null && getPlayCount() == stats.getPlayCount() && getTotalHits() == stats.getTotalHits() && getTotalScore() == stats.getTotalScore() && getRank() == stats.getRank();
} |
dd33a744-1916-4de0-8c1f-5c3fd1e6b0de | 8 | public Tile nearestUndefendedCity()
{
City nearest = null;
if (owner.cities.size() > 0)
{
for (int i = 0; i < owner.cities.size(); i++)
{
City candidate = owner.cities.get(i);
if (candidate.location.occupants.size() > 1)
continue;
else if (candidate.location.occupants.size() < 3)
if (... |
6a829ae5-a5e7-40b7-b44f-fb01c0387eff | 9 | public TwitterBullingAnalysisMain(String pathToSWN) throws IOException {
// This is our main dictionary representation
dictionary = new HashMap<String, Double>();
// From String to list of doubles.
HashMap<String, HashMap<Integer, Double>> tempDictionary = new HashMap<String, HashMap<Integer, Double>>();
Bu... |
7a35d1b9-c290-4679-a0fa-10b334602d1c | 7 | public void run()
{
InputStream lIn = null;
OutputStream lOut = null;
try
{
// Get the streams.
lIn = socket.getInputStream();
lOut = socket.getOutputStream();
if(!login(lIn, lOut, uid, pwd)) return;
// Start the ... |
26d87da1-190c-4044-bc4c-e5af88ea8426 | 6 | public boolean treesSymmetric(treeNode leftRoot, treeNode rightRoot){
if (leftRoot == null && rightRoot == null)
return true;
if (leftRoot == null || rightRoot == null)
return false;
return ( leftRoot.value == rightRoot.value &&
treesSymmetr... |
8383cfba-139a-4792-b2a6-ff92313462bb | 1 | public int getPort() {
if (rpcURL != null) {
return rpcURL.getPort();
} else {
return 0;
}
} |
7aea60e4-d978-451e-a892-fe0634e1f75b | 7 | public Scenery() {
for (int x = 0; x < Realm.WORLD_WIDTH; x++) {
for (int y = 0; y < Realm.WORLD_HEIGHT; y++) {
if (Realm.world.getTile(x, y) == Tile.GRASS) {
int seed = iRandom.nextInt(30);
if (seed < 3) {
if (seed == 0)
scenobjects[x][y] = GameObject.RED_FLOWER;
else if (seed ==... |
07b3a610-cd2c-4245-b7c1-f5321ed55203 | 4 | public NewsInfoDto getNewsInfoDto(int id) {
PreparedStatement stmt = null;
ResultSet rs = null;
NewsInfoDto newsInfoDto = null;
try {
stmt = conn
.prepareStatement("select author,title,content,creatTime from NewsInfo where id = ? ");
stmt.setInt(1, id);
rs = stmt.executeQuery();
String tit... |
947f70bf-b7b5-4038-aff9-417acb952290 | 5 | public static void setIntBE(final byte[] array, final int index, final int value, final int size) {
switch (size) {
case 0:
return;
case 1:
Bytes.setInt1(array, index, value);
break;
case 2:
Bytes.setInt2BE(array, index, value);
break;
case 3:
Bytes.setInt3BE(array, index, value);
... |
79986e6a-e086-4094-a1c6-491bf3b38a80 | 5 | public Object nextEntity(char ampersand) throws TXMLException {
StringBuffer sb = new StringBuffer();
for(;;) {
char c = next();
if(Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if(c == ';') {
break;
} else {
throw syntaxError("Missing ';' in TXML en... |
169abe54-7c27-4a90-b11d-12b980284935 | 7 | public void mouseEntered(MouseEvent evt) {
if (evt.getSource()==commercial){
mousein = 1;
}
if (evt.getSource()==residential){
mousein = 2;
}
if (evt.getSource()==industrial){
mousein = 3;
}
if (evt.getSource()==lumbermill){
mousein = 4;
}
if (evt.getSource()==government){
... |
c2853204-7aa1-4ff7-81aa-13052b6a35e2 | 7 | public static void main(String[] args) {
ArrayList<ArrayList<String>> puzzle = loadFile("puzzle.txt");
State parent = new State(puzzle);
System.out.println("Welcome to Josh's Sokoban searcher!");
System.out.println("1) Breadth first search");
System.out.println("2) Depth first search");
System.out.pr... |
072b65bd-a313-442c-8e44-d21bd30b81b0 | 0 | @Test
public void test_pauser() throws Exception {
stop_tunnel_in(1000);
final String lipsum = StringUtils.lipsum(20);
final long start = System.currentTimeMillis();
new StringTrafficker(getInt("pauser_local_port"),
getInt("pauser_remote_port"),
new St... |
2778d9a7-ffad-4fbe-be9c-0343e42249ad | 2 | public void setDefaults() {
//Default objects
final Map<String, Object> defaults = new LinkedHashMap<String, Object>();
defaults.put("Language", "English");
ArrayList<String> defaultPrintingCosts = new ArrayList<String>();
ArrayList<String> defaultClearingCosts = new ArrayList<String>();
//Default va... |
5d7b54e8-c398-4101-84ca-0424e11c14ce | 9 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : "";
if((!mob.isAttributeSet(MOB.Attrib.SYSOPMSGS) && (parm.length()==0))||(parm.equalsIgnoreCase("ON")))
mob.setAttribute(MOB.Attri... |
1da01a7c-8cbb-4f3e-89c5-e495cb650007 | 3 | public void setPriceForMultiple(ArrayList<Stock> sList) {
HashMap<String, Float> priceMap = new HashMap<>();
for (Stock s : sList) {
priceMap.put(s.getIdentifier(), s.getPrice());
}
NodeList nl = doc.getDocumentElement().getElementsByTagName("stock");
for (in... |
3c5b0350-5031-441e-af3e-1011301202e7 | 0 | protected void buildOutlineElement(Node node, String lineEnding, StringBuffer buf) {
// buf.append("<").append(ELEMENT_OUTLINE).append(" ");
//
// if (node.getCommentState() == Node.COMMENT_TRUE) {
// buf.append(ATTRIBUTE_IS_COMMENT).append("=\"true\" ");
// buf.append(ATTRIBUTE_IS_COMMENT_INHERITED).append("=\... |
f066df8a-10ff-4760-bef7-f1349d007452 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
7c636eca-589a-453b-b4db-69f964a78eb3 | 6 | public static void main(String[] args) {
/*
* Scanner keyboard = new Scanner(System.in);
* System.out.print("Please enter your age: "); int age =
* keyboard.nextInt();
*
* switch (age) { case 21: System.out.println(
* "You are 21 and the same age as Miley Cyrus! Not sure if that's good or bad."
... |
87f1e7bc-2ae8-4b91-887d-c39317c86812 | 5 | public static char three(int r, int c, int f) {
if (s4(r, c, f) || s5(r, c, f))
return '|';
else if (s3(r, c, f) || s6(r, c, f) || s7(r, c, f))
return '_';
return '.';
} |
b16ea46d-68da-4c4b-8b3b-6d16ecad45a5 | 4 | public String determineSign(int[] A) {
int n = 0;
for(int i = 0;i < A.length;i++){
if(A[i] < 0){
n++;
}else if(A[i] == 0){
return "ZERO";
}
}
if(n % 2 == 0){
return "POSITIVE";
}else{
return "NEGATIVE";
}
} |
96778d35-76fe-45db-907a-984ff3304249 | 4 | public void stud_avg_cal(BuyOrder order)
{
int su = 0;
for(Student stud : order.getStudList())
{
int sum = 0;
int i2 =0;
for(Double i : getJum())
{
sum += stud.getJum().get(i2) * i;
i2++;
}
... |
7606b1c2-77c4-4777-9433-dfc445010a1a | 7 | @SuppressWarnings({ "unchecked", "unused" })
static String parseSingle(Element element) throws JdaoHandlerException {
String tableName = element.attributeValue("name");
List<Element> lists = element.elements("field");
String Tablename = Utils.upperFirstChar(Utils.delUnderline(tableName));
StringBuilder sb = ne... |
40f4abd3-9667-46b5-9bc1-bfc2b1bf8ae3 | 1 | public GameActor createActor(String resource) {
// if not yet created, create a new prototype
if(!actors.containsKey(resource)) {
createPrototype(resource);
}
GameActor actor = actors.get(resource);
GameActor returned = factory.createActor(resource);
... |
e807f440-3467-4b9f-bf2d-e93921dbc952 | 7 | public static void outPutRailcarItinerary(ArrayList<ArrayList<Block>> bl){
try{
jxl.Workbook readWorkBook = jxl.Workbook.getWorkbook(new File("Output_File.xls")); //唯讀的Excel工作薄物件
jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("Output_File.xls"), readWorkBook); //寫入
jxl.write.... |
9e894d4a-32ce-4d8f-b1c8-83eb3bc3d85a | 3 | @Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
int x = context.ui.dw.turtle.getPosX();
int y = context.ui.dw.turtle.getPosY();
Value value = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
if (value.getType() == VariableType.N... |
52d2a147-42cc-492b-a930-44bc962ac427 | 3 | public RigidBody getRigidBody(TransformGroup transformGroup) {
for (Iterator<RigidBodyContainer> it = rigidBodies.iterator(); it
.hasNext();) {
RigidBodyContainer container = (RigidBodyContainer) it.next();
if (container.transformGroup == transformGroup) {
return container.rigidBody;
} else if (conta... |
7bd8d71f-5cff-4ccc-9ff7-374a5eeec56c | 4 | private void updateGame(Scene scene){
// Update the input devices:
for (InputDevice device : inputDevices.values())
device.update();
// Check scheduled Callbacks:
scene.checkCallbacks();
// Update the game:
if (!isFrozen()){
... |
301186dd-2d61-43b1-836f-6ea51ee4d296 | 5 | public void handleNextButton() {
if(!isChild){
ListModel<String> tapeAlphabetList = startView.getTapeAlphabetList().getModel();
ListModel<String> inputAlphabetList = startView.getInputAlphabetList().getModel();
ListModel<String> stateList = startView.getStateList().getModel();
... |
8d43df78-a36f-4831-8bb8-140a971889fe | 0 | public listUser()
{
this.info = "list all users";
} |
ec9da601-e090-43e6-ad87-0da4e1644737 | 0 | void setNames(String leftName, String rightName)
{
leftScorePanel.setName(leftName);
rightScorePanel.setName(rightName);
} |
3788d80d-cc32-402a-ab82-65808ce41d5c | 4 | public String getClipboardContents()
{
String result = "";
Transferable contents = clipboard.getContents(null);
boolean hasTransferableText = contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
if (hasTransferableText)
{
... |
ba2ac669-a39d-4ba0-b95f-b601e0f0f6fe | 9 | public static void main(String[] args) {
ExemploExecuteStatementSP obj = new ExemploExecuteStatementSP();
Scanner var = new Scanner(System.in).useDelimiter(System.getProperty("line.separator"));
String nome = null;
while (true) {
try {
System.out.println("OBS.: Caso a tabela agenda não exista excutar a c... |
ce5814c6-b0c4-4c08-bc87-bced096c3a14 | 9 | private void insertNumbers() {
Board board = getBoard();
BoardNumbers[] boardNumbers = new BoardNumbers[4];
for (int i = 0; i < boardNumbers.length; i++) {
boardNumbers[i] = new BoardNumbers();
}
/* Easter (New Year) egg */
int year = 0;
DateFormat dateFormat = new SimpleDateFormat("yyyy", Locale... |
1f14b6c3-cc34-475a-a81d-f37488bd4b60 | 5 | void showInfo(Graphics2D g, Subject s) {
final int x = 320;
final int y = 560;
g.setColor(shadow);
g.fillRect(0, y, 1200, 160);
g.setColor(border);
g.drawLine(0, y, 1200, y);
drawer.setStyle(mainFont);
if (s != null) {
Meta meta = s.meta... |
f5b10750-4935-4aa3-9802-8ae4f55eb26c | 4 | public boolean removeFile( String removeFile ) {
// if the file does not exist in the list of the files parsed, exit
// the method
if( ! filesParsed.contains( removeFile ) ) {
return false;
}
// create an iterator to parse through all the key value s... |
38438c6e-8e9a-41bc-a5d6-7840252c0dd7 | 2 | public String getOldestPerson() throws ParseException {
String name = "";
long age = 0;
for (String[] item : data) {
long ageInSeconds = getAgeInSeconds(item[DOB_INDEX].trim());
if (ageInSeconds > age) {
age = ageInSeconds;
name = item[NAME... |
160dd29e-459d-4f6d-96d1-e1aea0884c92 | 9 | public void run() throws Exception {
connection = DriverManager.getConnection(dbUrl);
// create projects
PreparedStatement ps = connection
.prepareStatement("select jg_key, jg_name, jg_description"
+ " from t_project");
ps.execute();
Result... |
eaa3645b-2370-4a3c-aaed-a591f1f6a66e | 7 | private void ParseOutElements(org.w3c.dom.Element parentElement) {
Node child = parentElement.getFirstChild();
while (child != null) {
if (! handleGeneralProperty(child)) {
String nodeName = child.getNodeName();
// Room specific properties: type, border[ ], container[ ], item[ ], creature[ ]
if (node... |
71379e29-947d-49a9-9bdf-0c693ad0955e | 4 | private void loadBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadBrowseButtonActionPerformed
JFileChooser f = new JFileChooser(loadFromField.getText());
File fi = new File(loadFromField.getText());
if(fi.isDirectory()) {
f.setCurrentDirectory(fi);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.