method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6adf3a99-111f-43c5-9832-4ff72bf00277 | 1 | *
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public Object converseObject(Object command)
throws UnknownHostException, IOExcept... |
5f3e42d9-9b7f-4af8-ac85-98c5431bbb99 | 8 | public final ProgramContext program() throws RecognitionException {
ProgramContext _localctx = new ProgramContext(_ctx, getState());
enterRule(_localctx, 0, RULE_program);
int _la;
try {
int _alt;
setState(51);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
_localctx = new ... |
4e33abad-1d7b-4f42-82a2-0170e31a3877 | 4 | @Override
public boolean setChartOption( String op, String val )
{
boolean bHandled = false;
if( op.equalsIgnoreCase( "Stacked" ) )
{
fStacked = val.equals( "true" );
bHandled = true;
}
else if( op.equalsIgnoreCase( "PercentageDisplay" ) )
{
f100 = val.equals( "true" );
bHandled = true;
}
... |
837983d5-e248-437d-8738-f30d4cb657bd | 3 | public static Item returnTeletab() {
for(Item i : Inventory.getItems()) {
if(i != null) {
if(i.getName().toLowerCase().contains("teleport")) {
return i;
}
}
}
return null;
} |
94137a45-2618-4379-b20d-9bab7e5ff5fc | 1 | public Problem findById(java.lang.Integer id) {
log.debug("getting Problem instance with id: " + id);
try {
Problem instance = (Problem) getSession().get(
"com.oj.hibernate.daoNdo.Problem", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
} |
70c55481-7783-4543-842c-0bf3f23e9dfe | 6 | public void paintComponent(Graphics g)
{
Rectangle rectToPaint = g.getClipBounds();
if(DEBUG)
{
System.out.println("Repainting: " + rectToPaint);
System.out.println("\tSampleWidth: " + sampleWidth);
System.out.println("\tframesPerPixel: " + framesPerPixel);
S... |
94d1943a-0af0-427a-b761-908cad26fd10 | 8 | protected void createDebianProperties(POMInfo info, POMInfo original, String debianPackage, int inLevel) throws XMLStreamException {
info.getProperties().put("debian.originalVersion", info.getOriginalVersion());
if (debianPackage != null) {
info.getProperties().put("debian.package", debianPa... |
cc627cbc-8b3d-4fed-854a-eac0a2a9f722 | 5 | public CtClass[] getNestedClasses() throws NotFoundException {
ClassFile cf = getClassFile2();
InnerClassesAttribute ica
= (InnerClassesAttribute)cf.getAttribute(InnerClassesAttribute.tag);
if (ica == null)
return new CtClass[0];
String thisName = cf.getName();
... |
27134435-c22d-4b06-86b8-a24528b8dbd7 | 1 | public void testWithField_nullField() {
YearMonth test = new YearMonth(2004, 6);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
e18fcf8e-3221-40f4-983a-d4bd211fa1ba | 0 | public static void main(String[] args) {
SampleCalc sample = new SampleCalc();
IncreaseThread inc = new IncreaseThread(sample);
DecreaseThread dec = new DecreaseThread(sample);
IncreaseThread inc1 = new IncreaseThread(sample);
DecreaseThread dec1 = new DecreaseThread(sample);
inc.start();
... |
f458a108-6e1c-47a7-b8d5-2660b77784f8 | 0 | public void setSkipLines(int skipLines) {
this.skipLines = skipLines;
} |
d233eb38-6088-42e3-87c9-26baefc6cc9d | 8 | public Flag CheckError()
{
boolean error = (lift.f == Flag.AMBER || lift.f == Flag.RED || drag.f == Flag.AMBER || drag.f == Flag.RED);
if(error)
{
blacklist.add(param);
}
Flag f = Flag.GREEN;
if(lift.f == Flag.AMBER || drag.f =... |
53507255-efd8-4bae-a11c-c51dd5acf0d9 | 2 | public boolean arePrefixesOfEachOther(String s1, String s2) {
if (s1.startsWith(s2) || s2.startsWith(s1))
return true;
return false;
} |
b367b735-85e0-4cea-abe7-6be77f891cdb | 9 | public void update() {
// Moves Character or Scrolls Background accordingly.
if (speedX < 0) {
centerX += speedX;
}
if (speedX == 0 || speedX < 0) {
bg1.setSpeedX(0);
bg2.setSpeedX(0);
}
if (centerX <= 200 && speedX > 0) {
centerX += speedX;
}
if (speedX > 0 && centerX > 200) {
bg1.setS... |
dda8d777-7f7f-4009-9a19-98885bf7ddce | 3 | @Override
protected void func_27260_a(int var1, int var2, Tessellator var3) {
super.func_27260_a(var1, var2, var3);
if(this.field_27268_b == 0) {
GuiStats.drawSprite(this.field_27275_a, var1 + 115 - 18 + 1, var2 + 1 + 1, 72, 18);
} else {
GuiStats.drawSprite(this.field_27275_a, va... |
ceb7b710-fe0c-415c-a303-ce934c94332c | 3 | @Override
public String toString() {
return "IkszorSecureObject " +
"[encodedValue=" + encodedValue + "[" + (encodedValue != null ? encodedValue.length() : "null")+"]" +
", symmetricKey=" + symmetricKey + "[" + (symmetricKey != null ? symmetricKey.length() : "null")+"]" +
", decodedValue=" + decodedValue... |
92e96628-4d93-4835-b643-1ce5e37b925b | 0 | public void setDestinationStart(int value) {
this._destinationStart = value;
} |
025f6b54-76df-4aae-b8b6-7bdbc287a216 | 4 | public int GetMatchLen(int index, int distance, int limit)
{
if (_streamEndWasReached)
{
if (_pos + index + limit > _streamPos)
{
limit = _streamPos - (_pos + index);
}
}
distance++;
// Byte *pby = _buffer + (size_t)_pos + i... |
4de0dfef-165b-4ed1-bf19-e4cb7228d622 | 9 | @Override
public void run() {
//create player
if(!PC.player1Connected){
PC.player1Connected = true;
PC.state.player.setPos(new Vector(2*PistolCaveGame.TILE_SIZE, 2*PistolCaveGame.TILE_SIZE));
PC.state.player.setDirection(2);
PC.state.firstPlayer = true;
}
else if(!PC.player2Connected){
PC.... |
16003b87-68cb-4326-a6ee-7ac2a69b7c96 | 8 | protected List<GitInformationCommit> loadCommits(Repository repository, Git git, Ref branch) throws GitAPIException, NoHeadException, IOException, MissingObjectException, IncorrectObjectTypeException, AmbiguousObjectException {
RevWalk revwalk = new RevWalk(repository);
List<GitInformationCommit> result = new Ar... |
fb46b24d-f428-4b5d-b8cf-710130ca13ec | 7 | public static String getHostName() {
String out = "No IP";
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface current = interfaces.nextElement();
out = ... |
bdf74ea9-fe89-4252-b01a-4d67bde5d13c | 6 | public static boolean allFunctionsNextP(AllPurposeIterator self) {
{ int cursor = self.iteratorInteger;
Symbol symbol = null;
MethodSlot function = null;
while (cursor < self.iteratorSecondInteger) {
symbol = ((Symbol)((Stella.$SYMBOL_ARRAY$.theArray)[cursor]));
if ((symbol != nul... |
f50d9b49-f7d3-4df6-ac00-1f58a30da0ff | 8 | protected void setType(int type) {
this.type = type;
//set color
switch (Math.abs(type)) {
case 1:
// inner1 = new Color(215, 15, 55);
// inner2 = new Color(254, 78, 113);
backgroundColor = new Color(255, 87, 107);
color2 ... |
fe431e30-fcb0-4673-91ab-e4d66348ada4 | 2 | public Account lookup (String id)
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("lookup", true);
$out.write_string (id);
$in = _invoke ($out);
Account $result = Account... |
bd0691a8-c52b-4fa3-a3d2-e8b121cad163 | 4 | public static void main(String args[]) throws InstantiationException, ClassNotFoundException {
try {
ConnectionManager.connect();
System.out.println("VA aparentemente");
} catch (SQLException ex) {
System.out.println(ex.getMessage());
System.exit(0);
... |
be85e5b6-27af-43ce-8111-346a3ee489e0 | 2 | public static int getPropertyInt(String name)
{
if(!new File(PROP_FILE).exists())
{
PROP_FILE = "/usr/share/tomcat7/.jenkins/jobs/PlagiatsJaeger/workspace/WebContent/WEB-INF/classes/config.properties";
}
Properties prop = new Properties();
try
{
// load a properties file
prop.load(new FileInpu... |
7647d72d-e17f-4801-9dea-7aefa84f8551 | 8 | public void run() {
try {
s = new Socket(ip, ServerThread.GAME_PORT);
inStream = s.getInputStream();
outStream = s.getOutputStream();
in = new BufferedReader(new InputStreamReader(inStream));
out = new PrintWriter(outStream,true);
... |
b3da54bf-ee82-488f-b083-65193259de19 | 5 | @Override
public Boolean pertinent(String keyword1, String keyword2){
for(int index = 0; index < children.length; index++){
if(children[index].root.get_function().equals("suj")){
Hashtable<String,Boolean> suj = new Hashtable<String,Boolean>();
suj.put(keyword1, true);
if(children[index].bfs_name(suj).... |
1ec4ce9b-dc9f-4e03-bb05-b1070546b09d | 6 | public void sortBy( String order ) {
DefaultMutableTreeNode tmpNode = null;
DefaultMutableTreeNode curNodeCopy = null;
SortTreeModel treeModelTmp = null;
DefaultMutableTreeNode rootTmp = new DefaultMutableTreeNode( rootNodeTxt );
if ( order.equals( "name" ) ) {
treeMo... |
69ec9858-8237-44de-aa73-ca0c447c6562 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
ae18b461-ba2a-48da-ada6-d81b607d3ca5 | 2 | String guessFields() {
StringBuilder sb = new StringBuilder();
Field fields[] = clazz.getFields();
for (Field f : fields)
sb.append(f.getName() + FIELD_NAME_SEPARATOR);
// Remove last ';'
if (sb.charAt(sb.length() - 1) == FIELD_NAME_SEPARATOR) sb.deleteCharAt(sb.length() - 1);
return sb.toString();
} |
a53ad12d-1709-4abb-83e1-fd51311fc09d | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String msj_exito = "Se dio de ba... |
c2a3719e-de3a-409c-a44f-a427418fe7b0 | 3 | public void mouseEntered(MouseEvent evt) {
if (evt.getSource()==newgame){
mousein = 1;
}
if (evt.getSource()==loadgame){
mousein = 2;
}
if (evt.getSource()==quitgame){
mousein = 3;
}
} |
829cee44-40e6-4619-b78a-9f63a8e3f5fe | 5 | private void initNewSchema()
throws CorrespondingDimensionNotExistsException {
SortedSet<DimensionLevelPair> dimensionLevelPairs = targetCondition
.getPairs();
SortedSet<Dimension> fromDimensions = fromSchema.getDimensions();
SortedSet<Dimension> newDimensions = new T... |
c930002f-c996-47d3-96d3-f7164420cc0e | 7 | public Menu getPrioritaryDisplayedMenu() {
if (isMenuDisplayed(MenuID.selectAnswerBox)) {
return getMenu(MenuID.selectAnswerBox);
}
else if (isMenuDisplayed(MenuID.storeMenu)) {
if (isMenuDisplayed(MenuID.transactionMenu)) {
return getMenu(MenuID.transacti... |
a2ef46d2-f7f4-4631-9da8-df4e2ca6adc8 | 0 | @Override
public ConnectionInfo getCurrentConnectionInfo() {
return (ConnectionInfo)localConnectionInfo.get();
} |
b37c42e7-35ed-4f67-8df8-bd426cc4c1e9 | 1 | @Override
public boolean containsKey(Object key) {
return key instanceof String
&& super.containsKey(((String) key).toLowerCase());
} |
523e1ddf-3336-4e53-9a92-acb554fe0aac | 8 | public static void main (String args[]) {
int iii,i,ic,k,m,n,nread,ntries,nwrite;
int info[] = new int[2];
// int nprob;
// int nfev[] = new int[2];
// int njev[] = new int[2];
int nprobfile[] = new int[29];
int nfile[] = new int[29];
int mfile[] = new int[29];
int... |
1fb727e5-e908-432f-8342-250e0954a3dc | 3 | public Double[] getStats(){//might be ugly but only loop through population once to get all the stats
double bestFitness = Double.MIN_VALUE;
double worstFitness = Double.MAX_VALUE;
double averageFitness = 0;
int bestIndex = -1;
int worstIndex = -1;
for (int i = 0; i<population.size(); i++){
double ind... |
8fe334f7-de16-432a-9921-7de504c26d93 | 4 | @Override
public void run() {
try{
if(_input.length == 1){
String fileName = _input[0];
String echoToScreen = fileName + " " + _server.getClientSocket().getInetAddress().getHostAddress() + " " + _server.getClientSocket().getPort();
System.out.println(echoToScreen);
String responseCommand = Protoco... |
643f0805-457d-40bc-9499-ee99345ecb79 | 3 | public int maxProfit1(int[] prices) {
int profit =0;
for (int i = 0; i < prices.length ;i++ )
for(int j = i+1 ; j< prices.length;j++){
if(prices[j] - prices[i] > profit)
profit = prices[j] - prices[i] ;
}
return profit;
} |
c68caade-37ec-4303-848c-679ec3eda5f5 | 3 | public boolean willIntersect(GameObj obj){
int next_x = pos_x + v_x;
int next_y = pos_y + v_y;
int next_obj_x = obj.pos_x + obj.v_x;
int next_obj_y = obj.pos_y + obj.v_y;
return (next_x + width >= next_obj_x
&& next_y + height >= next_obj_y
&& next_obj_x + obj.width >= next_x
&& next_obj_y + obj.... |
6f1356b3-e5a9-4973-a18c-d1c336035ce9 | 7 | @Override
public boolean equals(Object o) {
if(this == VOID || o == VOID) {
throw new RuntimeException("can't use VOID: " + this + " ==/!= " + o);
}
if(this == o) {
return true;
}
if(o == null || this.getClass() != o.getClass()) {
return false;
}
TLValue that = (TLValue)o... |
21843d14-211f-4e32-a9f3-d70ee7aabfa8 | 4 | public synchronized boolean remove(byte[] blob) {
if(blob == null) return false;
for(int i=0; i<identities.size(); i++) {
Identity _identity = (Identity)(identities.elementAt(i));
byte[] _blob = _identity.getPublicKeyBlob();
if(_blob == null || !Util.array_equals(blob, _blob))
continue... |
a7720fdb-c8b0-4c16-992a-e629bfa34c02 | 0 | public int calculate(int a, int b){
return strategy.calculate(a, b);
} |
7a3b93da-debd-4f6b-909f-4752634ef006 | 2 | public void closeConnection() {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
c90fce40-7ad3-4e1e-94ef-3406c81758f2 | 5 | public void scan()
{
if ( scannerData == null)
return ;
TKeyRefList keyList = scannerData.getKeyList() ;
Vector fileList = scannerData.getFileList() ;
codeScanner.setKeyList( keyList );
System.out.println( "scanner filelist " +fileList.size()) ;
keyList.clear() ; // remove all old e... |
c6e72617-65aa-4ee8-aff8-77fd750b4c00 | 6 | public static double eval() {
double loss = 0;
@SuppressWarnings("rawtypes")
Iterator userIter = DataInfo.userTest.iterator();
@SuppressWarnings("rawtypes")
Iterator ItemIter = DataInfo.itemTest.iterator();
@SuppressWarnings("rawtypes")
Iterator rateIter = DataInfo.rateTest.iterator();
while(userI... |
efd6bca3-d8ab-499d-a88f-6b9e28b8cdee | 2 | public RouteLength plus(RouteLength other)
{
if (uninitialized() || other.uninitialized())
{
return new RouteLength();
}
return new RouteLength(this.length + other.length);
} |
65121892-fd03-4d3c-bc60-f8b5db26f704 | 5 | public String getHelpText(HelpType input) {
String helpText = "";
switch (input) {
case BOARD:
case NUMBERS:
case PLAYER:
case STATISTICS:
case ENDGAME:
helpText = input.getHelpText();
break;
}
re... |
d4907240-153b-4eb7-952d-24c05731febc | 1 | public static String repeat(char ch, int repeat) {
char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
buf[i] = ch;
}
return new String(buf);
} |
5666dbf8-65ab-475a-8133-401340371d6a | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
ffa70ba4-eb32-4f59-b68c-bccac5b87901 | 1 | public OuterValues(ClassAnalyzer ca, Expression[] head) {
this.clazzAnalyzer = ca;
this.head = head;
this.headMinCount = 0;
this.headCount = head.length;
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_CONSTRS) != 0)
GlobalOptions.err.println("Created OuterValues: " + this);
} |
9f4ac7a6-5414-4699-88b0-35b4e9a05a28 | 5 | public boolean conflictwall(int rows,int columns){
int dx=0;
int dy=0;
switch ( this.getOrient() ) {
case RIGHT: dx = 1; break;
case DOWN: dy = 1; break;
}
int x = this.getX();
int y = this.getY();
for(int i=0; i<this.getLength(); i++){
x += dx; y += dy;
}
if(x>columns || y>rows){
return t... |
d386cc34-49ff-4742-acce-33749e49ee0a | 7 | @EventHandler(priority = EventPriority.HIGHEST)
public void onCreatureSpawn(final CreatureSpawnEvent event) {
if (!this.war.getConfig().getBoolean("ready-to-go")) {
event.setCancelled(true);
return;
}
if (this.war.getConfig().getBoolean("mob-spawns")) {
i... |
cb81c91f-09a8-4cb1-a1bc-f1a906b19ff2 | 4 | public void testBinaryCycAccess1() {
System.out.println("\n**** testBinaryCycAccess 1 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CO... |
262ef9c4-a26b-4dc3-9342-aa4d527a6d2a | 4 | private void initializeKingsClashMapUnits() {
Player bluePlayer = Teams.getPlayersOfTeam(Teams.BLUE);
if (bluePlayer != null) {
// set building placement & unit placement TOP LEFT
getCell(1, 1)
.setBuilding(new Base(getCell(1, 1), bluePlayer, game));
getCell(2, 2).setUnit(
new Marine(getCell(2, 2... |
765d53ad-7063-405c-aff3-41a01e4124dd | 0 | public static void LogException(Exception e, String action)
{
Severe("Exception while " + action);
Severe(e.toString());
e.printStackTrace();
} |
cee92bc2-65a6-42c4-8628-f2b696509bf7 | 1 | public void init(){
for(int i = 0; i < tileList.size(); i++){
Tile tile = tileList.get(i);
System.out.println("\nRegistered tile: \nName: " + tile.getTileName() + "\nID:" + tile.getID());
}
} |
21a6c500-6aa6-41c3-8ade-68d34955faf1 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... |
d8f5d831-4e41-4692-ab40-614f5a5e2c28 | 3 | public boolean saveTriggerXMLFile () {
try {
FileWriter xmlfile;
String line;
xmlfile=new FileWriter("trigger.xml");
// Start the XML file //
line="<?xml version='1.0' encoding='utf-8' standalone='yes'?>";
xmlfile.write(line);
line="\n<settings>";
xmlfile.write(line);
// Run through each T... |
1d8108d8-064e-4f8d-9a92-f530630bc7e7 | 5 | public static Tile findPlantTile(Actor actor, Venue nursery) {
Tile picked = null, tried ;
float bestRating = Float.NEGATIVE_INFINITY ;
for (int n = 10 ; n-- > 0 ;) {
tried = Spacing.pickRandomTile(
nursery, World.SECTOR_SIZE * 2, actor.world()
) ;
tried = Spacing.nearestOpenT... |
fb937942-1123-44a3-9de0-21485bca4cf4 | 4 | @Override public boolean equals(Object obj)
{
if (obj instanceof Programme)
{
Programme programme = (Programme) obj;
return (programme.episodeNumber == this.episodeNumber) &&
(programme.seasonNumber == this.seasonNumber) &&
(programme.episodeName.equals(this.episodeName)) &&
(programme.seriesName... |
479a4dc2-147b-4262-93a7-0ceddb62e79f | 4 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int[] nq = readInts(line), ab;
SegTree s = new Seg... |
0c4f464e-ba65-475e-af07-0af2aeb5ad10 | 3 | private static String vectorToStr(Vector<String> v, int lo, int hi) {
if (lo < 0 || hi > v.size()) return "";
String res = "[ ";
for (int i = lo; i < hi; i++) res += v.get(i) + " ";
return res + "]";
} |
f505f6f8-2e4a-41fe-bf65-31e8f910c6aa | 9 | public static void main(String[] args) {
try {
ArrayList<int[]> toSolve;
if (args == null || args.length == 0 || args[0] == "help"
|| args[0] == "man" || args[0] == "?") {
System.out.println("The argument format should be as follow: "
+ ARG_FORMAT);
toSolve = new ArrayList<int[]>();
} else... |
d144a4e9-ebbd-4790-b695-ffe0a231a7e6 | 7 | @Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
stage = 0;
sendDialogue((short) 237, new String[] {
"What would you like to say?", "Teleport me to Fight pits",
"Teleport me so I can fight TzHaar!",
"May I have a Fire cape? I think I'm worthy.",
"Never Mind."... |
f8d9190b-1119-447c-a909-e63c0862dbcd | 6 | @EventHandler
public void onBlockDamage(BlockDamageEvent event){
if(!(event.getBlock().getState() instanceof Chest))
return;
Chest chest = (Chest) event.getBlock().getState();
if(!plugin.isStore(chest) && !plugin.isCoffer(chest))
return;
/**
* We don't want to spam the player's messages if th... |
aa284653-3db0-43f1-b90f-190dfdbdb045 | 4 | void setMoney(int money) {
this.money = money;
for (Button b : buttons) {
if (!b.isBlank()) {
TowerButton tb = (TowerButton)b;
boolean canAfford = tb.getTowerData().buildCost <= money;
b.setActive(canAfford && !tb.towerLocked);
if(tb.towerLocked){
tb.setUnlockAreaActive(tb.getTowerData().unl... |
77cb201a-543f-4be4-b7ff-097f230a305c | 8 | public byte readByte()
{
switch ( type )
{
case MatDataTypes.miUINT8:
return (byte)( buf.get() & 0xFF);
case MatDataTypes.miINT8:
return (byte) buf.get();
case MatDataTypes.miUINT16:
return (byte)( buf.getShort() & 0... |
c5c2e99e-0a11-49f7-8a41-33b6afea5ec6 | 1 | @Override
public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> output, Reporter arg3) throws IOException {
int sumImpressions = 0;
int sumClicks = 0;
int sumConversions = 0;
String []countLineArr = null;
Text countLine = null;
while(values.hasNext()){
countLine = values... |
4a0bfcc6-5953-408e-9588-4dd0cd5ebd8d | 7 | public CSVNormaliser normalize(){
if(csvList.isEmpty()){
System.err.println("Tried to fill blanks on empty dataset.");
return this;
}
int numAttributes = csvList.get(0).length;
lowestValues = new double[numAttributes];
highestValues = new double[numAttributes];
for(int attribute = 0; attribute < nu... |
c34c886b-baf5-40bc-9fec-e661a3beeb5a | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected==null)||(!(affected instanceof Room)))
return super.tick(ticking,tickID);
if(!super.tick(ticking,tickID))
return false;
if(invoker()==null)
return true;
final Room R=invoker().location();
for(int i=0;i<R.numInhabitants();i... |
520d8812-d8f5-44e9-9c04-61dfbbfeeffc | 6 | public static void main(String argv[]) throws Exception {
String hostname = argv[0];
Integer port = Integer.parseInt(argv[1]);
String filepath = argv[2];
int timeout = Integer.parseInt(argv[3]);
FileInputStream inFromUser = new FileInputStream(filepath);
DatagramSocket clientSocket = new DatagramSocket();
... |
4ba7b627-8998-49f0-af9b-7dd6e342766d | 2 | public void trapFieldWrite(String name, Object value) {
Class jc = getJavaClass();
try {
jc.getField(name).set(null, value);
}
catch (NoSuchFieldException e) {
throw new RuntimeException(e.toString());
}
catch (IllegalAccessException e) {
... |
5c0315e8-37df-4ffd-bf66-b168901d814d | 8 | public void renderMobInWater(int xPos, int yPos, Tile tile, boolean flip, int tileNr) {
xPos -= xOffset;
yPos -= yOffset;
for (int y = 0; y < tile.sprite.SIZE / 2 + 2; y++) {
int yp = yPos + y;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int flipX = (flip) ? tile.sprite.SIZE - x - 1 : x;
int xp = xPos... |
53fa8554-4e2a-4d75-b845-29894cc2b0a4 | 3 | public static double getTurtleHeading(double x1,double y1,
double x2,double y2)
{
double heading = 0;
// don't allow a divide by zero
if (x1 == x2)
{
if (y2 > y1)
heading = 180;
else
heading = 0;
}
// calculate the heading fro... |
bfed59b9-fcab-4062-afaf-bf362e655be1 | 5 | public ImagePlus Kalmanizer(ImagePlus imp){
int m = stack.getWidth();
int n = stack.getHeight();
//imp2 = new ImagePlus("Kalman Stack Filter", imp.getProcessor());/*original*/
imp2 = new ImagePlus("Kalman Stack Filter", imp.getStack());/*7/25/03*/
stack2 = imp2.createEmptyStack();
int dimension = m*n;
int... |
ac6788f2-a9a6-4ade-bbd2-779a94d5a115 | 1 | public List<UserRole> findRoles(User user) throws Exception {
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Query q = session.getNamedQuery(getNamedQueryToFindRoles());
q.setString("user", Integer.toString(us... |
65cd07ca-595f-4b9f-8446-0cc57905ddc8 | 1 | @Override
public List<Double> predict(List<Double> in) {
if (filterInputs) {
return pLearner.predict(pTransform.transform(in));
} else {
return pTransform.untransform(pLearner.predict(in));
}
} |
7584044f-fc7d-40b5-936f-3175e55e71d1 | 9 | private void searchPaths(Graph graph, Object start, Object searched, ArrayList<Object> visited)
{
if(visited == null)
{
visited = new ArrayList<Object>();
visited.add(start);
}
ArrayList<Object> nodes;
if (visited.get(visited.size() - 1) instanceof Station) {
nodes = ((Station)(visited.get(vis... |
ae9172e8-1e34-4640-aa37-fe31e41c5a7a | 6 | public void init()
{
// Set up dictionary and board
dictionary = new Dictionary();
board = new RuzzleBoard();
solved = false;
// Set up GUI elements
pnlBoard = new JPanel();
pnlBoard.setLayout(new GridLayout(0,RuzzleBoard.NUM_COLS));
boardPanels = new... |
b33cab59-afa0-4492-a12a-402a9d36702a | 1 | public void visit_swap(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
c2a9474a-fee8-4516-9ac3-3c77624a7dc7 | 8 | private Map<Integer, InputAction> createMapOfInputBindings(){
String fileName = "resources/bindings/keyBindings"; // Hard coded?
File file = new File(fileName);
try {
Scanner scn = new Scanner(file);
Map<Integer, InputAction> map = new HashMap<Integer, InputAction>();
char[] line;
while (scn.hasNext... |
e0d6d80f-909f-4c04-a904-43edf6c230d7 | 0 | @Override
public String getStrategyName() {
// TODO Auto-generated method stub
return "默认策略";
} |
16b49d01-cb2d-4de4-8ff2-2d0fad4b655a | 9 | public void listen(){
_log("listening to new client...");
Socket client = null;
try{
_serverSocket = new ServerSocket(_server.clientsPort());
_serverSocket.setSoTimeout(1000*100);
while(true)
{
client = _serverSocket.accept();
_dlog("Get connection from " + client... |
3e013a8d-fc0b-4c51-a891-b6dc82dac430 | 6 | public boolean getCommandButtonVisibility(CommandButton btn) {
if (btn == null) {
throw new IllegalArgumentException();
}
boolean ret = true;
switch (btn) {
case SWITCH:
ret = this.buttonComSwitchVisible;
break;
case L... |
e64db122-0e99-4f63-be70-89bd104e33bc | 0 | public synchronized void bind(Socket socket) throws SocketException {
this.unbind(true);
this.exchange = new PeerExchange(this, this.torrent, socket);
this.exchange.register(this);
this.download = new Rate();
this.download.reset();
this.upload = new Rate();
this.upload.reset();
} |
a72b0b55-1233-4aff-902f-f2a59a34bde3 | 7 | private final void step6() {
j = k;
if (b[k] == 'e') {
int a = m();
if (a > 1 || a == 1 && !cvc(k-1))
k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1)
k--;
} |
84ccb97e-ecec-4e19-8e48-a4edd3501b5c | 9 | public boolean containsValue (Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = capacity + stashSize; i-- > 0;)
if (keyTable[i] != null && valueTable[i] == null) return true;
} else if (identity) {
for (int i = capacity... |
bc4ba25a-7415-4393-bd06-81648bfd3b32 | 4 | private static void hprof(LinksSaver linksSaver, int mapperProfNum, int reducerProfNum,
String hprofDir, String simpleDir, boolean hasCPU) {
String mapperUrl;
String reducerUrl;
// /home/xulijie/MR-MEM/HprofBigExperiments/HprofBigWiki-m36-r18/hprofLog/jobId/
File jobIdHprofFile = new File(hprofDir);
if... |
49740576-c49c-4408-a16a-fc668a721fb5 | 8 | @Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)e.getSource();
if (button.equals(Q3))
{
Boolean applicationQ3 = application.isQ3Associated();
if (associatedQ3 == false && applicationQ3.equals(false))
{
Q3.setText("Q3 - ASSOCIATED (Click to Disassociate over Q3)");
... |
fb6ef6c4-83e2-4b9f-8654-89524e9f608a | 8 | protected void TrusterMF() {
for (int iter = 1; iter <= numIters; iter++) {
loss = 0;
errs = 0;
// gradients of B, V, W
DenseMatrix BS = new DenseMatrix(numUsers, numFactors);
DenseMatrix WS = new DenseMatrix(numUsers, numFactors);
DenseMatrix VS = new DenseMatrix(numItems, numFactors);
// rate... |
e607ab5e-f5b1-432c-b001-caf0868a660c | 1 | @Test
public void test_setPause() {
appTimer.start();
ex.setPause(2);
appTimer.stop();
assertTrue("Fail - period of time must be same",
appTimer.getTotalTime() >= 2000 && appTimer.getTotalTime() < 2002);
} |
6599015b-3849-453c-a598-98f3e01fb154 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, ContentVersion__typeInfo)... |
b95d3c0c-eba7-47f2-ad86-0616fa4073a1 | 5 | public static String[] getAllSchoolName(BaseSetting bs) {
if (bs == null) {
System.out.println("school - BS NULL");
} else {
//On initialise la liste des écoles
ArrayList<String> list = new ArrayList<>();
try {
//
//Si la... |
c8ceb121-d3de-41b5-8200-04669bccb125 | 6 | private void convertIBMGenerator() {
DataInputStream myInput = null;
try {
// Objects to read the input file in binary format
FileInputStream fin = new FileInputStream(new File(input));
myInput = new DataInputStream(fin);
// Variable to remember if we have written -1 after a group of items or not
... |
df85dc05-8ff7-4c9b-ab27-6849ffb803ff | 0 | public boolean getRock() {
return rock;
} |
ba2353a8-2a36-4082-8d11-ae85c4ef7b3f | 8 | public void clear_Bit(int position, int adress) {
switch (position) {
case 0: {
setRegisterEntryOneBit(adress,
(getRegisterEntry(adress) & 0b11111110));
break;
}
case 1: {
setRegisterEntryOneBit(adress,
(getRegisterEntry(adress) & 0b11111101));
break;
}
case 2: {
setRegisterEntryOne... |
04036dc7-065a-4551-a7eb-47cc0f6617c4 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.